Registry / azure / azure-mgmt-resource-templatespecs

azure-mgmt-resource-templatespecs

JSON →
library1.0.0b1pypypi✓ verified 24d ago

The `azure-mgmt-resource-templatespecs` library is the Microsoft Azure Resource Templatespecs Management Client Library for Python. It allows developers to programmatically manage Azure Template Specs, which are a feature for storing, managing, and versioning Azure Resource Manager (ARM) templates as first-party Azure resources with integrated access control. The current version is 1.0.0b1, and as part of the Azure SDK for Python, it follows an active release cadence with frequent updates, often including beta releases before stable versions.

pip install azure-mgmt-resource-templatespecs azure-identity
INSTALL
IMPORT
SIG · AZURE-MGMT-RESOURC
A
azure-mgmt-resource-templatespecs
azurepythonv1.0.0b1
Install
3.8s avg
Import
545ms
Disk
43MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.0b1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.574s · 43.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.8s · import 0.516s · 44MB
43MB installed
● package 43MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TemplateSpecsClient
from azure.mgmt.resource.templatespecs import TemplateSpecsClient
DefaultAzureCredential
from azure.identity import DefaultAzureCredential
TemplateSpecsClient
from azure.mgmt.resource import TemplateSpecsClient
The `templatespecs` module was separated from `azure-mgmt-resource` into its own dedicated package in recent versions.

This quickstart demonstrates how to authenticate with Azure and initialize the `TemplateSpecsClient` to interact with Template Specs. It uses `DefaultAzureCredential` for flexible authentication and then lists existing Template Specs by subscription. Ensure `AZURE_SUBSCRIPTION_ID` and other authentication-related environment variables are set.

import os from azure.identity import DefaultAzureCredential from azure.mgmt.resource.templatespecs import TemplateSpecsClient # Set environment variables for authentication and subscription: # AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET (for service principal) # AZURE_SUBSCRIPTION_ID subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "") # Authenticate using DefaultAzureCredential # This credential type attempts to authenticate via various methods # (environment variables, managed identity, Azure CLI, etc.) credential = DefaultAzureCredential() # Create a TemplateSpecsClient client = TemplateSpecsClient(credential=credential, subscription_id=subscription_id) # Example: List all template specs in the subscription print("Listing Template Specs...") for template_spec in client.template_specs.list_by_subscription(): print(f" Template Spec Name: {template_spec.name}, Location: {template_spec.location}") # Note: This is a basic example. For more complex operations like creating, # updating, or deploying Template Specs, refer to the official Azure SDK samples.
Debug
Known issues
breakingThe `templatespecs` module has been separated from the `azure-mgmt-resource` package into its own independent package, `azure-mgmt-resource-templatespecs`. If you previously imported `TemplateSpecsClient` via `from azure.mgmt.resource import TemplateSpecsClient`, you must update your code to import directly from `azure.mgmt.resource.templatespecs`.
fix
Update import statements to `from azure.mgmt.resource.templatespecs import TemplateSpecsClient`.
affects: Users migrating from older `azure-mgmt-resource` (e.g., versions prior to 25.0.0) where templatespecs was bundled.
gotchaAuthentication with Azure services often requires setting specific environment variables for `DefaultAzureCredential` to work correctly. Without these, authentication attempts may fail.
fix
Ensure `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` (for service principal) and `AZURE_SUBSCRIPTION_ID` are set as environment variables. Alternatively, use other `azure-identity` credential types suitable for your environment.
affects: All versions of `azure-mgmt-resource-templatespecs`.
gotchaAs a beta package (`1.0.0b1`), the API surface or behavior of `azure-mgmt-resource-templatespecs` may change before its stable 1.0.0 release, potentially introducing breaking changes without a major version increment.
fix
Be prepared for potential API adjustments and consult release notes for future beta and stable versions. Pinning to a specific beta version is recommended for stability in non-development environments.
affects: Versions `1.0.0b1` and other beta releases.
gotchaWhen deploying ARM templates using Template Specs, especially with linked templates, you might encounter 'Unable to retrieve the template artifact' errors if linked templates are not accessible (e.g., local files not uploaded or incorrect paths).
fix
Host linked templates in Azure Blob storage or ensure they are properly embedded/referenced with correct paths within the Template Spec. Validate templates with `az deployment group validate` before deployment.
affects: All versions.
Upgrade
Version history
1.0.0b1latest on PyPI · released Jun 10, 2025
Audit
Dependencies
azure-identityrequiredRequired for Azure Active Directory token authentication.
PythonrequiredRequires Python version 3.9 or higher.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources