{"id":5581,"library":"azure-mgmt-resource-deploymentscripts","title":"Microsoft Azure Resource Deploymentscripts Management Client Library for Python","description":"This is the Microsoft Azure Resource Deploymentscripts Management Client Library for Python. It provides capabilities to manage deployment scripts within Azure Resource Manager (ARM) templates, allowing for custom steps like adding users, performing data plane operations, or creating self-signed certificates during deployments. The current version is 1.0.0b1, indicating a beta release. Azure SDK for Python packages, including beta releases, are published to PyPI regularly, reflecting active development.","status":"active","version":"1.0.0b1","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","management","resource","deploymentscripts","sdk","arm"],"install":[{"cmd":"pip install azure-mgmt-resource-deploymentscripts","lang":"bash","label":"Install core package"},{"cmd":"pip install azure-identity","lang":"bash","label":"Install Azure Identity for authentication"}],"dependencies":[{"reason":"Required for Azure Active Directory token authentication.","package":"azure-identity","optional":false},{"reason":"Requires Python 3.9 or later.","package":"python","optional":false}],"imports":[{"symbol":"DeploymentScriptsClient","correct":"from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient"},{"symbol":"DefaultAzureCredential","correct":"from azure.identity import DefaultAzureCredential"}],"quickstart":{"code":"import os\nfrom azure.identity import DefaultAzureCredential\nfrom azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient\n\n# Set environment variables for authentication and subscription ID:\n# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET\n# AZURE_SUBSCRIPTION_ID\n# For local development, `DefaultAzureCredential` can often pick up credentials from `az login`.\n\nsubscription_id = os.environ.get(\"AZURE_SUBSCRIPTION_ID\", \"YOUR_SUBSCRIPTION_ID\")\n\nif subscription_id == \"YOUR_SUBSCRIPTION_ID\":\n    print(\"WARNING: Please set the AZURE_SUBSCRIPTION_ID environment variable for a functional example.\")\n\ntry:\n    credential = DefaultAzureCredential()\n    client = DeploymentScriptsClient(credential=credential, subscription_id=subscription_id)\n\n    print(f\"DeploymentScriptsClient initialized successfully for subscription: {subscription_id}\")\n\n    # Example: List deployment scripts (uncomment to run)\n    # print(\"Listing deployment scripts...\")\n    # for script in client.deployment_scripts.list_by_subscription():\n    #     print(f\"- Script Name: {script.name}, Resource Group: {script.id.split('/')[4]}\")\n\n    # To create, update, or delete deployment scripts, refer to the official Azure SDK samples\n    # for detailed usage of `client.deployment_scripts.begin_create_or_update` or other operations.\n\nexcept Exception as e:\n    print(f\"An error occurred during client initialization or operation: {e}\")\n    print(\"Please ensure you are authenticated to Azure (e.g., `az login`) and AZURE_SUBSCRIPTION_ID is set.\")","lang":"python","description":"This quickstart demonstrates how to initialize the `DeploymentScriptsClient` using `DefaultAzureCredential` for authentication. It requires the `AZURE_SUBSCRIPTION_ID` environment variable to be set, along with other Azure Active Directory environment variables for `DefaultAzureCredential` to function correctly (e.g., `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`). For local development, `az login` can often provide the necessary credentials. The example includes a placeholder for listing deployment scripts."},"warnings":[{"fix":"Review release notes for each new beta version and anticipate potential API changes. Pin the package version to avoid unexpected updates.","message":"This package is currently in a beta state (version 1.0.0b1). This means the API surface might change in future releases, potentially introducing breaking changes before a stable 1.0.0 release.","severity":"gotcha","affected_versions":"1.0.0b1 and earlier beta versions"},{"fix":"Monitor resource groups where deployment scripts run. Manually verify and clean up any lingering 'azscripts' prefixed storage accounts or container instances if automatic cleanup fails.","message":"Deployment scripts create supporting resources (a storage account and a container instance) for execution and troubleshooting. While these are usually cleaned up automatically, charges may be incurred if they are not removed successfully after the script finishes.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that the deployment script resource in your ARM template specifies an appropriate user-assigned managed identity, especially if the script needs to interact with Azure resources. Verify the API version being used in the template (`apiVersion`).","message":"For Azure Resource Manager (ARM) template deployment scripts, an identity is crucial. For API version 2019-10-01-preview, a managed identity is *required*. For API version 2020-10-01 or later, it is optional unless the script performs Azure-specific actions requiring authentication. Currently, only user-assigned managed identities are supported.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Chain PowerShell or CLI commands into a single line using semicolons (` ; `), `\\r\\n`, or `\\n`. Alternatively, store the script in an external file (e.g., on GitHub or in a storage account) and reference it using the `primaryScriptUri` property in your ARM template.","message":"When embedding multi-line scripts directly into an ARM template using the `scriptContent` property, the Azure portal and Azure DevOps pipelines may fail to parse them.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If your application relies on a specific, non-latest API-Version, it is recommended to pin the package version. Always review release notes for stable (`1.0.0` and above) versions for API-Version targeting changes.","message":"Other `azure-mgmt-resource-*` packages have moved to only target the latest API-Version available, removing older API versions. While not explicitly stated for `azure-mgmt-resource-deploymentscripts`, this is a common breaking change pattern across the Azure SDK for Python management libraries that could affect this package in the future.","severity":"breaking","affected_versions":"Potentially future stable versions (e.g., 1.0.0)"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}