{"id":1937,"library":"azure-mgmt-resource-templatespecs","title":"Azure Resource Templatespecs Management Client Library for Python","description":"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.","status":"active","version":"1.0.0b1","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["Azure","Cloud","Resource Management","ARM Templates","Template Specs","Infrastructure as Code"],"install":[{"cmd":"pip install azure-mgmt-resource-templatespecs azure-identity","lang":"bash","label":"Install with authentication library"}],"dependencies":[{"reason":"Required for Azure Active Directory token authentication.","package":"azure-identity","optional":false},{"reason":"Requires Python version 3.9 or higher.","package":"Python","optional":false}],"imports":[{"symbol":"TemplateSpecsClient","correct":"from azure.mgmt.resource.templatespecs import TemplateSpecsClient"},{"symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"},{"note":"The `templatespecs` module was separated from `azure-mgmt-resource` into its own dedicated package in recent versions.","wrong":"from azure.mgmt.resource import TemplateSpecsClient","symbol":"TemplateSpecsClient"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.resource.templatespecs import TemplateSpecsClient\n\n# Set environment variables for authentication and subscription:\n# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET (for service principal)\n# AZURE_SUBSCRIPTION_ID\n\nsubscription_id = os.environ.get(\"AZURE_SUBSCRIPTION_ID\", \"\")\n\n# Authenticate using DefaultAzureCredential\n# This credential type attempts to authenticate via various methods\n# (environment variables, managed identity, Azure CLI, etc.)\ncredential = DefaultAzureCredential()\n\n# Create a TemplateSpecsClient\nclient = TemplateSpecsClient(credential=credential, subscription_id=subscription_id)\n\n# Example: List all template specs in the subscription\nprint(\"Listing Template Specs...\")\nfor template_spec in client.template_specs.list_by_subscription():\n    print(f\"  Template Spec Name: {template_spec.name}, Location: {template_spec.location}\")\n\n# Note: This is a basic example. For more complex operations like creating,\n# updating, or deploying Template Specs, refer to the official Azure SDK samples.\n","lang":"python","description":"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."},"warnings":[{"fix":"Update import statements to `from azure.mgmt.resource.templatespecs import TemplateSpecsClient`.","message":"The `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`.","severity":"breaking","affected_versions":"Users migrating from older `azure-mgmt-resource` (e.g., versions prior to 25.0.0) where templatespecs was bundled."},{"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.","message":"Authentication with Azure services often requires setting specific environment variables for `DefaultAzureCredential` to work correctly. Without these, authentication attempts may fail.","severity":"gotcha","affected_versions":"All versions of `azure-mgmt-resource-templatespecs`."},{"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.","message":"As 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.","severity":"gotcha","affected_versions":"Versions `1.0.0b1` and other beta releases."},{"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.","message":"When 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).","severity":"gotcha","affected_versions":"All versions."}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}