Registry / azure / azure-mgmt-extendedlocation

azure-mgmt-extendedlocation

JSON →
library2.0.0pypypi✓ verified 24d ago

The Microsoft Azure Extended Location Management Client Library for Python provides functionality to manage Custom Locations and Resource Sync Rules within Azure. These extended locations allow Azure services to run in environments outside of Azure datacenters. The current version is 2.0.0, and new versions are released regularly to keep pace with Azure service updates.

pip install azure-mgmt-extendedlocation
INSTALL
IMPORT
SIG · AZURE-MGMT-EXTENDE
A
azure-mgmt-extendedlocation
azurepythonv2.0.0
Install
2.5s avg
Import
Disk
22MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 24.1MB
glibc
py 3.103.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.
fix
Rewrite 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`.
fix
Ensure 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.
fix
Always 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.

Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
azure-mgmt-extendedlocation — pip install azure-mgmt-extendedlocation · libregistry