Registry /
azure / azure-mgmt-extendedlocation
Install & Compatibility
Where this runs
tested against v2.0.0 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 24.1MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.5s · import 0.000s · 25MB
22MB installed
● package 22MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CustomLocationsManagementClient
✓ from azure.mgmt.extendedlocation import CustomLocationsManagementClient
✗ from azure.mgmt.extendedlocation import CustomLocationsManagementClient
This quickstart demonstrates how to instantiate the `ExtendedLocationMgmtClient` using `DefaultAzureCredential` and list custom locations within your Azure subscription. Ensure `AZURE_SUBSCRIPTION_ID` is set as an environment variable and you have appropriate permissions.
import os
from azure.identity import DefaultAzureCredential
from azure.mgmt.extendedlocation import ExtendedLocationMgmtClient
# Set your Azure Subscription ID as an environment variable (e.g., AZURE_SUBSCRIPTION_ID)
subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "")
if not subscription_id:
raise ValueError("AZURE_SUBSCRIPTION_ID environment variable must be set.")
# Authenticate using DefaultAzureCredential
# This will attempt to authenticate via environment variables, managed identity,
# Azure CLI, Azure Developer CLI, Visual Studio Code, etc.
credential = DefaultAzureCredential()
# Create the ExtendedLocation Management client
client = ExtendedLocationMgmtClient(credential, subscription_id)
print(f"Listing custom locations for subscription: {subscription_id}")
# Iterate through custom locations in the subscription
try:
custom_locations = client.custom_locations.list_by_subscription()
for cl in custom_locations:
print(f" - Custom Location Name: {cl.name}, Location: {cl.location}, ID: {cl.id}")
except Exception as e:
print(f"An error occurred: {e}")
print("Make sure your account has permissions and AZURE_SUBSCRIPTION_ID is correct.")
Debug
Known issues
breakingMajor breaking changes occurred in Azure SDK for Python Track 2 (version 2.x) compared to older Track 1 versions (0.x or 1.x). Client instantiation, authentication (now using `azure.identity`), and object models have been completely revised.fixRewrite client instantiation and authentication to use `DefaultAzureCredential` from `azure.identity`. Refer to the official Azure SDK documentation for the new API surface.
affects: 0.x.x, 1.x.x -> 2.x.x
gotchaAuthentication with `DefaultAzureCredential` relies on specific environment variables (e.g., `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_TENANT_ID` for service principals, or `AZURE_SUBSCRIPTION_ID` for the management client) or other configured authentication mechanisms (Azure CLI, VS Code, etc.). Misconfiguration will lead to `CredentialUnavailableError`.fixEnsure the necessary environment variables are set or you are logged in via an authenticated tool like Azure CLI (`az login`). For service principals, ensure required variables are present. The `AZURE_SUBSCRIPTION_ID` must also be explicitly passed to the management client.
affects: All 2.x.x versions
gotchaMany resource creation or update operations in Azure management libraries are Long Running Operations (LROs). These methods return a poller object (e.g., `LROPoller`) immediately. You must call `.result()` on the poller to wait for the operation to complete and retrieve the final resource object.fixAlways call `.result()` on the object returned by methods like `create_or_update` to ensure the operation has finished and to get the fully provisioned resource: `custom_location = client.custom_locations.begin_create_or_update(...).result()`.
affects: All 2.x.x versions
Upgrade
Version history
2.0.0latest on PyPI · released Oct 30, 2024
Audit
Dependencies
No dependency data recorded yet.