Registry /
azure / azure-mgmt-resource-deploymentscripts
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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.604s · 98.2MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.0s · import 0.518s · 25MB
53MB installed
● package 53MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
DeploymentScriptsClient
✓ from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient
DefaultAzureCredential
✓ from azure.identity import DefaultAzureCredential
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.
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient
# Set environment variables for authentication and subscription ID:
# AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
# AZURE_SUBSCRIPTION_ID
# For local development, `DefaultAzureCredential` can often pick up credentials from `az login`.
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "YOUR_SUBSCRIPTION_ID")
if subscription_id == "YOUR_SUBSCRIPTION_ID":
print("WARNING: Please set the AZURE_SUBSCRIPTION_ID environment variable for a functional example.")
try:
credential = DefaultAzureCredential()
client = DeploymentScriptsClient(credential=credential, subscription_id=subscription_id)
print(f"DeploymentScriptsClient initialized successfully for subscription: {subscription_id}")
# Example: List deployment scripts (uncomment to run)
# print("Listing deployment scripts...")
# for script in client.deployment_scripts.list_by_subscription():
# print(f"- Script Name: {script.name}, Resource Group: {script.id.split('/')[4]}")
# To create, update, or delete deployment scripts, refer to the official Azure SDK samples
# for detailed usage of `client.deployment_scripts.begin_create_or_update` or other operations.
except Exception as e:
print(f"An error occurred during client initialization or operation: {e}")
print("Please ensure you are authenticated to Azure (e.g., `az login`) and AZURE_SUBSCRIPTION_ID is set.")
Debug
Known issues
gotchaThis 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.fixReview release notes for each new beta version and anticipate potential API changes. Pin the package version to avoid unexpected updates.
affects: 1.0.0b1 and earlier beta versions
gotchaDeployment 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.fixMonitor resource groups where deployment scripts run. Manually verify and clean up any lingering 'azscripts' prefixed storage accounts or container instances if automatic cleanup fails.
affects: All versions
gotchaFor 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.fixEnsure 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`).
affects: All versions
gotchaWhen 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.fixChain 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.
affects: All versions
breakingOther `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.fixIf 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.
affects: Potentially future stable versions (e.g., 1.0.0)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'azure.mgmt.resource.deploymentscripts'
The `azure-mgmt-resource-deploymentscripts` package or one of its dependencies is not installed, or there's an issue with the Python environment's path.
fixEnsure the package is correctly installed using pip: `pip install azure-mgmt-resource-deploymentscripts==1.0.0b1` or `pip install azure-mgmt-resource-deploymentscripts` for the latest beta.
AuthenticationFailed
The credentials provided to authenticate with Azure lack the necessary permissions to perform the requested deployment script operations, or there's an issue with the authentication token.
fixVerify that the Azure service principal or managed identity used for authentication has appropriate roles (e.g., Contributor or a custom role with specific permissions for deployment scripts, storage accounts, and container instances) in the relevant subscription and resource group. Check tenant ID and ensure the account belongs to the correct tenant.
The storage account named <storage-account-name> is already taken.
An Azure Deployment Script automatically creates a storage account and a container instance to execute the script. This error occurs when a previously created storage account with the same generated name was not cleaned up successfully, and a new deployment attempt tries to reuse the taken name.
fixManually delete the orphaned storage account and its associated resources, or modify the deployment script (e.g., by changing the resource ID or adding a `forceUpdateTag` property in ARM templates) to force the creation of a new, uniquely named storage account.
AttributeError: module 'azure.mgmt.resource.deploymentscripts' has no attribute 'DeploymentScriptsClient'
The main client class or an expected attribute/method is either misspelled, located in a different submodule, or its name has changed, which is common in beta releases of libraries.
fixReview the official `azure-mgmt-resource-deploymentscripts` documentation or SDK examples for version `1.0.0b1` to find the correct import path and class name for the client (e.g., `from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient` or checking for a client within a `_client` submodule).
Upgrade
Version history
1.0.0b1latest on PyPI · released Jun 10, 2025
Audit
Dependencies
azure-identityrequiredRequired for Azure Active Directory token authentication.
pythonrequiredRequires Python 3.9 or later.