### Install Dependencies and Run Sample Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-responses/samples/README.md Installs the necessary requirements and runs the getting started sample. ```bash pip install -r requirements.txt python sample_01_getting_started.py ``` -------------------------------- ### Install Azure SDK from source Source: https://github.com/azure/azure-sdk-for-python/blob/main/README.rst Clone the repository and run the setup script to install all packages from source. ```bash git clone git://github.com/Azure/azure-sdk-for-python.git cd azure-sdk-for-python python setup.py install ``` -------------------------------- ### Environment Setup and Running Samples Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/communication/azure-communication-chat/README.md Set environment variables for endpoint and connection string, install the necessary package, and run the Python sample scripts. Both synchronous and asynchronous versions are available. ```bash set AZURE_COMMUNICATION_SERVICE_ENDPOINT="https://.communcationservices.azure.com" set COMMUNICATION_SAMPLES_CONNECTION_STRING="" pip install azure-communication-identity python samples\chat_client_sample.py python samples\chat_client_sample_async.py python samples\chat_thread_client_sample.py python samples\chat_thread_client_sample_async.py ``` -------------------------------- ### Setup environment for stress tests Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/webpubsub/azure-messaging-webpubsubclient/stress/how-to-run.md Install the package and development dependencies in the local environment. ```cmd (env) ~/azure-messaging-webpubsubclient> pip install . (env) ~/azure-messaging-webpubsubclient> pip install -r dev_requirements.txt ``` -------------------------------- ### Getting Started with TextResponse Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-responses/samples/README.md This sample demonstrates the simplest async handler that echoes user input using TextResponse. ```python from azure.ai.agentserver.responses import TextResponse async def echo_handler(context): return TextResponse(text=context.get_input()) ``` -------------------------------- ### Install the package Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-ghcopilot/README.md Install the azure-ai-agentserver-ghcopilot package using pip. ```bash pip install azure-ai-agentserver-ghcopilot ``` -------------------------------- ### Install the Package Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-optimization/README.md Install the azure-ai-agentserver-optimization package using pip. ```bash pip install azure-ai-agentserver-optimization ``` -------------------------------- ### Install and Run Samples Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-render/README.md Commands to set the subscription key, install the library, and execute sample scripts. ```bash set AZURE_SUBSCRIPTION_KEY="" pip install azure-maps-render --pre python samples/sample_authentication.py python samples/sample_get_copyright_caption.py python samples/sample_get_copyright_for_tile.py python samples/sample_get_copyright_for_world.py python samples/sample_get_copyright_from_bounding_box.py python samples/sample_get_map_attribution.py python samples/sample_get_map_static_image.py python samples/sample_get_map_tile.py python samples/sample_get_map_tileset.py ``` -------------------------------- ### Full setup.py Example for Azure SDK Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/packaging.md A comprehensive example of a `setup.py` file for an Azure SDK for Python package, including metadata, package definitions, and dependencies. ```python #!/usr/bin/env python #------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-------------------------------------------------------------------------- import re import os.path from io import open from setuptools import find_packages, setup # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-keyvault" PACKAGE_PPRINT_NAME = "KeyVault" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace('-', '/') # a-b-c => a.b.c namespace_name = PACKAGE_NAME.replace('-', '.') # Version extraction inspired from 'requests' with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*["\"]([^\"\\]*)[\"\\]', fd.read(), re.MULTILINE).group(1) if not version: raise RuntimeError('Cannot find version information') with open('README.rst', encoding='utf-8') as f: readme = f.read() with open('HISTORY.rst', encoding='utf-8') as f: history = f.read() setup( name=PACKAGE_NAME, version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + '\n\n' + history, license='MIT License', author='Microsoft Corporation', author_email='azpysdkhelp@microsoft.com', url='https://github.com/Azure/azure-sdk-for-python', classifiers=[ 'Development Status :: 4 - Beta', 'Programming Language :: Python', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ], python_requires=">=3.10", zip_safe=False, packages=find_packages(exclude=[ 'tests', # Exclude packages that will be covered by PEP420 or nspkg 'azure', ]), install_requires=[ 'msrest>=0.5.0', 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', ], ) ``` -------------------------------- ### Install Dependencies for LightGBM Python Package Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/ml/azure-ai-ml/tests/test_configs/batch_setup/light_gbm_examples/python-guide/README.md Install necessary libraries like scikit-learn, pandas, matplotlib, and scipy using pip. These are required for running the examples. ```bash pip install scikit-learn pandas matplotlib scipy -U ``` -------------------------------- ### Server Startup Comparison (1.x vs 2.x) Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-core/MigrationGuide.md Illustrates the difference in server startup between the older 1.x SDK and the new 2.x SDK, which includes a built-in server. ```python # Before (1.x): agent = MyAgent() agent.run() # or manual uvicorn/hypercorn setup ``` ```python # After (2.x): # Responses protocol app = ResponsesAgentServerHost() @app.response_handler async def handle(request, context, cancellation_signal): ... app.run() # Built-in Hypercorn server with OpenTelemetry, health endpoint, graceful shutdown ``` -------------------------------- ### Receive Events from Custom Starting Position Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/eventhub/azure-eventhub/samples/README.md Examples for starting event reception from a specific position within a partition. This allows for targeted data retrieval or reprocessing. ```python import asyncio from azure.eventhub import EventHubConsumerClient,から_sequence_number, from_offset consumer_group = "$Default" def on_event_batch(partition_context, events): for event in events: print(f"Received event: {event.body_as_str()} from partition {partition_context.partition_id}") async def main(): client = EventHubConsumerClient.from_connection_string( conn_str="", eventhub_name="", consumer_group=consumer_group ) async with client: # Example: Start from a specific sequence number # await client.receive(on_event_batch=on_event_batch, starting_position=from_sequence_number(100)) # Example: Start from a specific offset await client.receive(on_event_batch=on_event_batch, starting_position=from_offset(10000)) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Install Beta Azure Package Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/sphinx/python_mgmt_migration_guide.md Install the latest preview package for a beta release of an Azure service example. Beta releases are indicated by a 'b' in the version number. ```bash pip install azure-mgmt-beta-service-example==10.0.0b1 ``` -------------------------------- ### Run Hello World Sample Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agrifood/azure-agrifood-farming/samples/README.md Execute the sample_hello_world.py script to verify your setup and authentication. This command assumes your environment variables are correctly set. ```bash python sample_hello_world.py ``` -------------------------------- ### begin_start Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/compute/azure-mgmt-compute/api.md Starts the virtual machine instances within a scale set. ```APIDOC ## begin_start ### Description Starts the virtual machine instances within a scale set. ### Method POST ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **vm_scale_set_name** (str) - Required - The name of the virtual machine scale set. #### Query Parameters - **api-version** (str) - Required - The API version to use for this operation. #### Request Body - **vm_instance_i_ds** (VirtualMachineScaleSetVMInstanceIDs or JSON or IO[bytes]) - Optional - A list of virtual machine instance IDs to start. - **content_type** (str) - Optional - The content type of the request body, defaults to "application/json". ### Request Example ```json { "instanceIds": [ "0", "1" ] } ``` ### Response #### Success Response (200 OK) Returns an LROPoller that can be used to track the long-running operation. #### Response Example (LROPoller object) ``` -------------------------------- ### Setup AutoRest Environment Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/storage/azure-storage-queue/swagger/README.md Commands to clone the repository and install dependencies for the AutoRest Python generator. ```powershell cd C:\work git clone --recursive https://github.com/Azure/autorest.python.git cd autorest.python git checkout azure-core npm install ``` -------------------------------- ### Begin Start Managed Instance Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/sql/azure-mgmt-sql/api.md Begins the long-running operation to start a managed instance. ```python @distributed_trace_async async def begin_start( self, resource_group_name: str, managed_instance_name: str, **kwargs: Any ) -> AsyncLROPoller[ManagedInstance]: ... ``` -------------------------------- ### Begin Start Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/compute/azure-mgmt-compute/api.md Starts a virtual machine. This is an asynchronous operation. ```APIDOC ## POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start ### Description Starts a virtual machine. This is an asynchronous operation. ### Method POST ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start ### Parameters #### Path Parameters - **resourceGroupName** (str) - Required - The name of the resource group. - **vmName** (str) - Required - The name of the virtual machine. #### Query Parameters - **api-version** (str) - Required - The API version to use for this operation. ### Response #### Success Response (200) An AsyncLROPoller that polls the start status. The final result is None. ``` -------------------------------- ### Set up virtual environment for running samples Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/contentunderstanding/azure-ai-contentunderstanding/README.md This snippet shows how to set up a Python virtual environment, activate it, and install the necessary SDK and dependencies for running samples and tests. Ensure you are in the correct package directory before running these commands. ```bash # 1. Navigate to package directory cd sdk/contentunderstanding/azure-ai-contentunderstanding # 2. Create virtual environment (only needed once) python -m venv .venv # 3. Activate virtual environment source .venv/bin/activate # On Linux/macOS # .venv\Scripts\activate # On Windows # 4. Install SDK and all dependencies pip install azure-ai-contentunderstanding # Install SDK if you haven't installed it in the previous step pip install -r dev_requirements.txt # Includes aiohttp, pytest, python-dotenv, azure-identity ``` -------------------------------- ### Get All Type Definitions Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/purview/azure-purview-catalog/README.md Retrieve all type definitions from the Purview Catalog. This example demonstrates error handling for HttpResponseError. ```python from azure.purview.catalog import PurviewCatalogClient from azure.identity import DefaultAzureCredential from azure.core.exceptions import HttpResponseError credential = DefaultAzureCredential() client = PurviewCatalogClient(endpoint="https://.purview.azure.com", credential=credential) try: response = client.types.get_all_type_definitions() # print out all of your entity definitions print(response['entityDefs']) except HttpResponseError as e: print(e) ``` -------------------------------- ### Get VM Host Payload Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/dynatrace/azure-mgmt-dynatrace/api.md Retrieves the VM host payload for a Dynatrace monitor resource, used for agent installation. ```APIDOC ## GET /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.SaaS/monitors/{monitorName}/getVmHostPayload ### Description Retrieves the VM host payload for a Dynatrace monitor resource, used for agent installation. ### Method GET ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.SaaS/monitors/{monitorName}/getVmHostPayload ### Parameters #### Path Parameters - **resourceGroupName** (str) - Required - The name of the resource group. - **monitorName** (str) - Required - The name of the monitor resource. ### Response #### Success Response (200) - **vmExtensionVersion** (str) - The version of the VM extension. - **vmExtension** (str) - The VM extension payload. ``` -------------------------------- ### Initialize ExampleClient with AzureKeyCredential Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/request_builders.md Initializes the ExampleClient using an AzureKeyCredential. Replace 'myCredential' with your actual key. ```python from azure.core.credentials import AzureKeyCredential from azure.example import ExampleClient credential = "myCredential" client = ExampleClient( endpoint="https://www.example.org/", credential=AzureKeyCredential(credential) ) ``` -------------------------------- ### Implement a test case Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/openai/azure-openai/README.md Example structure for a test class using the AzureRecordedTestCase helper and the configure decorator for client setup. ```python import pytest import openai from devtools_testutils import AzureRecordedTestCase # we don't record but this gives us access to nice helpers from conftest import ( GPT_4_AZURE, # Maps to Azure resource with gpt-4* model deployed GPT_4_OPENAI, # Maps to OpenAI testing with gpt-4* model configure, # Configures the client and necessary kwargs for the test PREVIEW, # Maps to the latest preview version of the API STABLE, # Maps to the latest stable version of the API ) @pytest.mark.live_test_only # test is live only class TestFeature(AzureRecordedTestCase): @configure # creates the client and passes through the kwargs to the test @pytest.mark.parametrize( # parametrizes the test to run with Azure and OpenAI clients "api_type, api_version", [(GPT_4_AZURE, PREVIEW), (GPT_4_OPENAI, "v1")] # list[tuple(api_type, api_version), ...] ) def test_responses(self, client: openai.AzureOpenAI | openai.OpenAI, api_type, api_version, **kwargs): # call the API feature(s) to test response = client.responses.create( input="Hello, how are you?", **kwargs, # model is passed through kwargs ) # test response assertions assert response.id is not None assert response.created_at is not None assert response.model assert response.object == "response" assert response.status in ["completed", "incomplete", "failed", "in_progress"] assert response.usage.input_tokens is not None assert response.usage.output_tokens is not None ``` -------------------------------- ### Begin Start Packet Capture Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/network/azure-mgmt-network/api.md Asynchronously starts a packet capture session on a virtual network gateway. ```APIDOC ## begin_start_packet_capture ### Description Starts a packet capture session on a virtual network gateway. This is an asynchronous operation that returns a long-running operation poller. ### Method POST ### Endpoint (This is an SDK method, not a direct HTTP endpoint. The underlying API call would typically be a POST to a resource-specific URI.) ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **virtual_network_gateway_name** (str) - Required - The name of the virtual network gateway. #### Query Parameters - **content_type** (str) - Optional - Defaults to "application/json". Specifies the content type of the request. #### Request Body - **parameters** (Optional[VpnPacketCaptureStartParameters | JSON | IO[bytes]]) - Optional - Parameters for starting the packet capture. Can be a VpnPacketCaptureStartParameters object, JSON string, or bytes stream. ### Request Example (Example depends on the type of parameters provided) ### Response #### Success Response (200 OK) - Returns an AsyncLROPoller that can be used to track the progress of the operation. The poller will eventually yield a string upon successful completion. ``` -------------------------------- ### Run Azure Event Hubs Sample Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/traces/README.md Installs the Event Hubs and tracing libraries before executing the Event Hubs sample script. ```sh $ # azure-eventhub library $ pip install azure-eventhub $ # azure sdk core tracing library for opentelemetry $ pip install azure-core-tracing-opentelemetry $ # from this directory $ python sample_event_hub.py ``` -------------------------------- ### Upload Pandas DataFrame (Python) Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/README.md Example showing how to upload a Pandas DataFrame as logs. This requires the 'pandas' library to be installed. ```python import pandas as pd from azure.core.exceptions import ClientAuthenticationError from azure.identity import DefaultAzureCredential from azure.monitor.ingestion import LogsIngestionClient # ... other setup ... credential = DefaultAzureCredential() client = LogsIngestionClient(endpoint=endpoint, credential=credential) data = { "col1": [1, 2, 3], "col2": ["a", "b", "c"] } df = pd.DataFrame(data) # Example of uploading a DataFrame try: response = client.upload(rule_id=rule_id, stream_name=stream_name, logs=df) print(response) except ClientAuthenticationError as e: print(f"Authentication Error: {e}") except Exception as e: print(f"An error occurred: {e}") ``` -------------------------------- ### EventPerfTest start_events_sync Method Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/perfstress_tests.md Implement this method to start the synchronous process for receiving events. This method can block as it runs during setup in a thread. ```python class EventPerfTest: def start_events_sync(self) -> None: # Must be implemented - starts the synchronous process for receiving events. # This can be blocking for the duration of the test as it will be run during setup() in a thread. pass ``` -------------------------------- ### Quick Start: Initialize and Run GitHub Copilot Adapter Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-ghcopilot/samples/README.md This snippet shows the basic steps to create an instance of the GitHubCopilotAdapter from a project directory and then run it. Ensure environment variables for configuration are set as per the package README. ```python from azure.ai.agentserver.githubcopilot import GitHubCopilotAdapter adapter = GitHubCopilotAdapter.from_project(".") adapter.run() ``` -------------------------------- ### Install and Run Azure Maps Route Samples Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/maps/azure-maps-route/README.md Commands to set the subscription key, install the package, and execute various sample scripts. ```bash set AZURE_SUBSCRIPTION_KEY="" pip install azure-maps-route --pre python samples/sample_authentication.py python sample/sample_get_route_range.py python samples/sample_get_route_directions.py python samples/sample_request_route_matrix.py python samples/async_samples/sample_authentication_async.py python samples/async_samples/sample_get_route_range_async.py python samples/async_samples/sample_request_route_matrix_async.py python samples/async_samples/sample_get_route_directions_async.py ``` -------------------------------- ### Run Request with Async Pipeline using TrioRequestsTransport Source: https://github.com/azure/azure-sdk-for-python/blob/main/eng/tools/azure-sdk-tools/tests/integration/scenarios/snippet-updater/README.md Example of executing a request asynchronously using the TrioRequestsTransport. Ensure Trio is installed. ```python from azure.core.pipeline.transport import TrioRequestsTransport async with AsyncPipeline(TrioRequestsTransport(), policies=policies) as pipeline: return await pipeline.run(request) ``` -------------------------------- ### Begin Start Application Gateway Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/network/azure-mgmt-network/api.md Starts the specified application gateway. This is a long-running operation. ```python async def begin_start( self, resource_group_name: str, application_gateway_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: ... ``` -------------------------------- ### EnvironmentVariableLoader Test Setup Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/test_proxy_troubleshooting.md Example of a test class using the EnvironmentVariableLoader preparer which may trigger fixture errors if not properly wrapped. ```python class TestExample(AzureRecordedTestCase): @EnvironmentVariableLoader("keyvault", azure_keyvault_url="https://vaultname.vault.azure.net") def test_example(self, azure_keyvault_url): ``` -------------------------------- ### Install Dependencies and Run Sample Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/traces/README.md Commands to install the necessary Azure Text Analytics and tracing libraries and execute the sample script. ```sh $ # azure-ai-textanalytics library $ pip install azure-ai-textanalytics $ # azure sdk core tracing library for opentelemetry $ pip install azure-core-tracing-opentelemetry $ # from this directory $ python sample_text_analytics.py ``` -------------------------------- ### Get Replication Vault Health Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/recoveryservices/azure-mgmt-recoveryservicessiterecovery/api.md Retrieves the health details of the replication vault. This provides an overview of the health status of your disaster recovery setup. ```python vault_health = client.replication_vault_health.get(resource_group_name, resource_name) ``` -------------------------------- ### Minimal agent quick start Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-ghcopilot/README.md Initialize and run the GitHubCopilotAdapter with default settings. Ensure environment variables like FOUNDRY_PROJECT_ENDPOINT and GITHUB_TOKEN are set. ```python from dotenv import load_dotenv load_dotenv() from azure.ai.agentserver.githubcopilot import GitHubCopilotAdapter adapter = GitHubCopilotAdapter.from_project(".") adapter.run() ``` -------------------------------- ### Install the Content Understanding SDK Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/contentunderstanding/azure-ai-contentunderstanding/README.md Install the client library for Python using pip. Ensure Python 3.9 or later is used. ```bash python -m pip install azure-ai-contentunderstanding ``` -------------------------------- ### EventPerfTest start_events_async Method Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/perfstress_tests.md Implement this method to start the asynchronous process for receiving events. This method can block as it will be scheduled in the event loop during setup. ```python class EventPerfTest: async def start_events_async(self) -> None: # Must be implemented - starts the asynchronous process for receiving events. # This can be blocking for the duration of the test as it will be scheduled in the eventloop during setup(). pass ``` -------------------------------- ### VpnPacketCaptureStartParameters Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/network/azure-mgmt-network/api.md Parameters for starting a VPN packet capture. ```APIDOC ## Class azure.mgmt.network.models.VpnPacketCaptureStartParameters Parameters for starting a VPN packet capture. ### Properties - **filter_data** (Optional[str]): Filter data for the packet capture. ### Methods - **__init__**: Initializes a new instance of the VpnPacketCaptureStartParameters class. - Overload 1: Initializes with specific properties. - Overload 2: Initializes from a mapping. ``` -------------------------------- ### Interact with Blob Service Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/storage/azure-storage-blob/README.md Examples for interacting with the blob service. This includes getting account information, setting service properties, and managing containers. ```python # Get account information # Get and set service properties # Get service statistics # Create, list, and delete containers # Get the Blob or Container client ``` -------------------------------- ### Configuring Model Deployments for Prebuilt Analyzers Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/contentunderstanding/azure-ai-contentunderstanding/samples/README.md Runs a setup script to configure essential model deployments (GPT-4.1, GPT-4.1-mini, text-embedding-3-large) required by prebuilt analyzers. Navigate to the samples directory and activate your virtual environment before execution. ```bash source .venv/bin/activate cd samples python sample_update_defaults.py ``` -------------------------------- ### Display Performance Test README Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/eventhub/azure-eventhub/CLIENT_DEVELOPER.md View the README file in the performance test directory to get specific setup instructions and guidance on running the tests locally. ```bash cat README.md ``` -------------------------------- ### Run Azure Event Grid Sample Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/traces/README.md Installs the Event Grid and tracing libraries before executing the Event Grid sample script. ```sh $ # azure-azure-eventgrid library $ pip install azure-eventgrid $ # azure sdk core tracing library for opentelemetry $ pip install azure-core-tracing-opentelemetry $ # from this directory $ python sample_event_grid.py ``` -------------------------------- ### Begin Start Express Route Site Failover Simulation Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/network/azure-mgmt-network/api.md Asynchronously starts a failover simulation for an ExpressRoute circuit on a virtual network gateway. ```APIDOC ## begin_start_express_route_site_failover_simulation ### Description Starts a failover simulation for an ExpressRoute circuit associated with a virtual network gateway. This is an asynchronous operation. ### Method POST ### Endpoint (This is an SDK method, not a direct HTTP endpoint. The underlying API call would typically be a POST to a resource-specific URI.) ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **virtual_network_gateway_name** (str) - Required - The name of the virtual network gateway. #### Query Parameters - **peering_location** (str) - Required - The peering location for the ExpressRoute circuit. #### Request Body (No request body is explicitly defined for this method in the provided snippet, but **kwargs** may contain additional parameters.) ### Response #### Success Response (200 OK) - Returns an AsyncLROPoller that can be used to track the progress of the operation. The poller will eventually yield a string upon successful completion. ``` -------------------------------- ### Install azure-iot-deviceprovisioning Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/iothub/azure-iot-deviceprovisioning/README.md Install the Azure IoT Device Provisioning client library for Python using pip. ```bash pip install azure-iot-deviceprovisioning ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/eventhub/azure-eventhub/CLIENT_DEVELOPER.md Create a Python virtual environment and install development dependencies. This isolates project dependencies and ensures a clean development setup. ```bash # Linux/macOS python -m venv .venv && source .venv/bin/activate && pip install -r dev_requirements.txt # Windows PowerShell python -m venv .venv; .\.venv\Scripts\Activate.ps1; pip install -r dev_requirements.txt ``` -------------------------------- ### Begin Get Next Hop Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/network/azure-mgmt-network/api.md Begins the operation to get the next hop from the virtual machine. This operation is asynchronous. ```APIDOC ## begin_get_next_hop ### Description Begins the asynchronous operation to retrieve the next hop from a virtual machine. ### Method Signature ```python def begin_get_next_hop(self, resource_group_name: str, network_watcher_name: str, parameters: JSON | IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> LROPoller[NextHopResult] ``` ### Parameters * **resource_group_name** (str) - The name of the resource group. * **network_watcher_name** (str) - The name of the network watcher. * **parameters** (JSON | IO[bytes]) - Parameters that define the next hop query. * **content_type** (str) - Defaults to "application/json". * **kwargs** - Additional keyword arguments. ``` -------------------------------- ### Get Type Definition using DataMapClient Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/purview/azure-purview-datamap/README.md Example of retrieving type definitions using the DataMapClient. This snippet demonstrates basic client usage and error handling for HttpResponseError. ```python from azure.purview.datamap import DataMapClient from azure.identity import DefaultAzureCredential from azure.core.exceptions import HttpResponseError client = DataMapClient(endpoint='', credential=DefaultAzureCredential()) try: client.type_definition.get() except HttpResponseError as e: print('service responds error: {}'.format(e.response.json())) ``` -------------------------------- ### Sample Hello World Output Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agrifood/azure-agrifood-farming/samples/README.md This is an example of the expected output after successfully running the sample_hello_world.py script, indicating successful party creation or update. ```text Creating party, or updating if party already exists... Done Here are the details of the party: ID: contoso-party Name: Contoso Description: Contoso is hard working. Created timestamp: 2021-06-21 10:21:11+00:00 Last modified timestamp: 2021-06-22 21:01:35+00:00 ``` -------------------------------- ### Begin Start Packet Capture Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/network/azure-mgmt-network/api.md Asynchronously begins the process of starting a packet capture on a virtual network gateway connection. ```APIDOC ## POST /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGatewayConnections/{virtualNetworkGatewayConnectionName}/StartPacketCapture ### Description Asynchronously begins the process of starting a packet capture on a virtual network gateway connection. ### Method POST ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGatewayConnections/{virtualNetworkGatewayConnectionName}/StartPacketCapture ### Parameters #### Path Parameters - **resourceGroupName** (str) - Required - The name of the resource group. - **virtualNetworkGatewayConnectionName** (str) - Required - The name of the virtual network gateway connection. #### Query Parameters - **api-version** (str) - Required - The API version to use for the request. #### Request Body - **parameters** (Optional[VpnPacketCaptureStartParameters | JSON | IO[bytes]]) - Optional - The parameters for starting the packet capture. - **content_type** (str) - Optional - The content type of the request body, defaults to 'application/json'. ### Response #### Success Response (200 OK) - **str** - A string indicating the status of the packet capture operation. ``` -------------------------------- ### Begin Get VM Security Rules Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/network/azure-mgmt-network/api.md Begins the operation to get the security rules on the network interface. This operation is asynchronous. ```APIDOC ## begin_get_vm_security_rules ### Description Initiates an asynchronous operation to retrieve the security rules associated with a virtual machine's network interface. ### Method Signature ```python def begin_get_vm_security_rules(self, resource_group_name: str, network_watcher_name: str, parameters: SecurityGroupViewParameters | JSON | IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> LROPoller[SecurityGroupViewResult] ``` ### Parameters * **resource_group_name** (str) - The name of the resource group. * **network_watcher_name** (str) - The name of the network watcher. * **parameters** (SecurityGroupViewParameters | JSON | IO[bytes]) - Parameters for the security rules query. * **content_type** (str) - Defaults to "application/json". * **kwargs** - Additional keyword arguments. ``` -------------------------------- ### Manage Custom Models (v3.1) Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/README.md Provides examples for managing custom models, including training, getting, listing, and deleting models. Requires a Form Recognizer client instance. ```python from azure.ai.formrecognizer import FormRecognizerClient, FormRecognizerApiVersion # For demonstration purposes, we use placeholder values. Replace with your actual values. endpoint = "YOUR_FORM_RECOGNIZER_ENDPOINT" key = "YOUR_FORM_RECOGNIZER_API_KEY" form_recognizer_client = FormRecognizerClient(endpoint, FormRecognizerApiVersion.V3_1, AzureKeyCredential(key)) # Example: List custom models print("Listing custom models:") for model in form_recognizer_client.list_custom_models(): print(f"- Model ID: {model.model_id}") # Example: Get a specific custom model (replace with a valid model ID) # try: # model_id = "YOUR_MODEL_ID" # model = form_recognizer_client.get_custom_model(model_id) # print(f"\nGot model: {model.model_id}") # except Exception as e: # print(f"Error getting model {model_id}: {e}") # Example: Delete a custom model (replace with a valid model ID) # try: # model_id = "YOUR_MODEL_ID" # form_recognizer_client.delete_custom_model(model_id) # print(f"\nDeleted model: {model_id}") # except Exception as e: # print(f"Error deleting model {model_id}: {e}") ``` -------------------------------- ### XUnit-style Setup Method Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/tests-advanced.md Use setup_method for setup tasks that need to run before each test method. Ensure setup logic is idempotent as it may be called multiple times. ```python from devtools_testutils.azure_recorded_testcase import get_credential class TestService(AzureRecordedTestCase): def setup_method(self, method): """This method is called before each test in the class executes.""" credential = self.get_credential(ServiceClient) # utility from parent class self.client = ServiceClient("...", credential) @classmethod def setup_class(cls): """This method is called only once, before any tests execute.""" credential = get_credential() # only module-level and classmethod utilities are available cls.client = ServiceClient("...", credential) ``` -------------------------------- ### Run Simple Example Script for LightGBM Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/ml/azure-ai-ml/tests/test_configs/batch_setup/light_gbm_examples/python-guide/README.md Execute the simple_example.py script to demonstrate basic LightGBM functionalities. This includes constructing datasets, training, prediction, and early stopping. ```bash python simple_example.py ``` -------------------------------- ### Install Azure preview packages Source: https://github.com/azure/azure-sdk-for-python/blob/main/README.rst Use the --pre flag with pip to install preview versions of Azure libraries. ```console $ pip install --pre azure-mgmt-compute # will install only the latest Compute Management library ``` -------------------------------- ### Send Small Logs Asynchronously (Python) Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-ingestion/README.md Asynchronous example for sending small logs using the Azure Monitor Ingestion client. Requires an async context and appropriate credential setup. ```python import asyncio from azure.core.exceptions import ClientAuthenticationError from azure.identity import DefaultAzureCredential from azure.monitor.ingestion import LogsIngestionClient # ... other setup ... credential = DefaultAzureCredential() client = LogsIngestionClient(endpoint=endpoint, credential=credential) # Example of sending logs asynchronously async def send_logs_async(): try: response = await client.upload(rule_id=rule_id, stream_name=stream_name, logs=logs) print(response) except ClientAuthenticationError as e: print(f"Authentication Error: {e}") except Exception as e: print(f"An error occurred: {e}") asyncio.run(send_logs_async()) ``` -------------------------------- ### begin_start Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/compute/azure-mgmt-compute/api.md Begin starting a Virtual Machine Scale Set or specific instances within it. This operation is asynchronous and returns a poller object. ```APIDOC ## async def begin_start(self, resource_group_name: str, vm_scale_set_name: str, vm_instance_i_ds: Optional[VirtualMachineScaleSetVMInstanceIDs] = None, *, content_type: str = "application/json", **kwargs: Any) -> AsyncLROPoller[None] ### Description Begin starting a Virtual Machine Scale Set or specific instances within it. ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **vm_scale_set_name** (str) - Required - The name of the VM scale set. #### Query Parameters - **vm_instance_i_ds** (Optional[VirtualMachineScaleSetVMInstanceIDs]) - Optional - IDs of the virtual machine instances to start. - **content_type** (str) - Optional - The content type for the request. Defaults to "application/json". ### Returns - **AsyncLROPoller[None]** - An asynchronous long-running operation poller that returns None upon completion. ``` -------------------------------- ### Get User Delegation Key - Azure Queue Storage Python Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/storage/azure-storage-queue/api.md Obtains a user delegation key for authenticating requests. This key is time-bound and requires specifying expiry and optionally start times. ```python async def get_user_delegation_key(self, *, delegated_user_tid: Optional[str] = ..., expiry: datetime, start: Optional[datetime] = ..., timeout: Optional[int] = ..., **kwargs: Any) -> UserDelegationKey: ... ``` -------------------------------- ### Start Local Test Server Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/core/azure-core-experimental/samples/pyodide_integration/readme.md Launch a local HTTP server to host the test environment. ```python python -h http.server ``` -------------------------------- ### Notebook Workspace Operations Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/cosmos/azure-mgmt-cosmosdb/api.md Manages notebook workspaces within an Azure Cosmos DB account. Supports creation, update, deletion, regeneration of auth tokens, starting, getting details, listing, and retrieving connection information. ```APIDOC ## begin_create_or_update Notebook Workspace ### Description Creates or updates a notebook workspace for a Cosmos DB account. ### Method POST ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName} ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **account_name** (str) - Required - The name of the database account. - **notebook_workspace_name** (Union[str, NotebookWorkspaceName]) - Required - The name of the notebook workspace. #### Request Body - **notebook_create_update_parameters** (NotebookWorkspaceCreateUpdateParameters or IO[bytes]) - Required - Parameters for creating or updating the notebook workspace. - **content_type** (str) - Optional - Defaults to "application/json". ### Response #### Success Response (200 or 201) - **NotebookWorkspace** - Details of the created or updated notebook workspace. ## begin_delete Notebook Workspace ### Description Deletes a notebook workspace from a Cosmos DB account. ### Method DELETE ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName} ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **account_name** (str) - Required - The name of the database account. - **notebook_workspace_name** (Union[str, NotebookWorkspaceName]) - Required - The name of the notebook workspace. ### Response #### Success Response (204) - None ## begin_regenerate_auth_token Notebook Workspace ### Description Regenerates the authentication token for a notebook workspace. ### Method POST ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/regenerateAuthToken ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **account_name** (str) - Required - The name of the database account. - **notebook_workspace_name** (Union[str, NotebookWorkspaceName]) - Required - The name of the notebook workspace. ### Response #### Success Response (204) - None ## begin_start Notebook Workspace ### Description Starts a notebook workspace. ### Method POST ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/start ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **account_name** (str) - Required - The name of the database account. - **notebook_workspace_name** (Union[str, NotebookWorkspaceName]) - Required - The name of the notebook workspace. ### Response #### Success Response (204) - None ## get Notebook Workspace ### Description Retrieves the properties of a notebook workspace. ### Method GET ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName} ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **account_name** (str) - Required - The name of the database account. - **notebook_workspace_name** (Union[str, NotebookWorkspaceName]) - Required - The name of the notebook workspace. ### Response #### Success Response (200) - **NotebookWorkspace** - Details of the notebook workspace. ## list_by_database_account Notebook Workspaces ### Description Lists all notebook workspaces associated with a database account. ### Method GET ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **account_name** (str) - Required - The name of the database account. ### Response #### Success Response (200) - **ItemPaged[NotebookWorkspace]** - A paged list of notebook workspaces. ## list_connection_info Notebook Workspace ### Description Retrieves connection information for a notebook workspace. ### Method GET ### Endpoint /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/{notebookWorkspaceName}/listConnectionInfo ### Parameters #### Path Parameters - **resource_group_name** (str) - Required - The name of the resource group. - **account_name** (str) - Required - The name of the database account. - **notebook_workspace_name** (Union[str, NotebookWorkspaceName]) - Required - The name of the notebook workspace. ### Response #### Success Response (200) - **NotebookWorkspaceConnectionInfoResult** - Connection information for the notebook workspace. ``` -------------------------------- ### Full OpenTelemetry Configuration with Console Exporter Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/core/azure-core-tracing-opentelemetry/README.md A full example demonstrating how to configure OpenTelemetry with a console exporter and integrate it with Azure SDKs for tracing. This setup allows Azure SDK clients to emit spans that are then processed and exported. ```python from azure.core.settings import settings settings.tracing_implementation = "opentelemetry" from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import ConsoleSpanExporter from opentelemetry.sdk.trace.export import SimpleSpanProcessor exporter = ConsoleSpanExporter() trace.set_tracer_provider(TracerProvider()) trace.get_tracer_provider().add_span_processor( SimpleSpanProcessor(exporter) ) from azure.storage.blob import BlobServiceClient tracer = trace.get_tracer(__name__) with tracer.start_as_current_span(name="MyApplication"): client = BlobServiceClient.from_connection_string('connectionstring') client.create_container('my_container') # Call will be traced ``` -------------------------------- ### Instantiate WebSiteManagementClient (Before Migration) Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/azure_mgmt_web_migration.md Shows the previous way of instantiating the client and accessing operations for certificates and domains. ```python from azure.mgmt.web import WebSiteManagementClient client = WebSiteManagementClient(...) # Operations for certificates and domains were on the main client client.app_service_certificate_orders.list(...) client.domain_registration_provider.list_operations(...) ``` -------------------------------- ### View sdk_build help documentation Source: https://github.com/azure/azure-sdk-for-python/blob/main/eng/tools/azure-sdk-tools/README.md Displays the command-line interface help for the sdk_build tool. ```text usage: sdk_build [-h] [-d DISTRIBUTION_DIRECTORY] [--service SERVICE] [--pkgfilter PACKAGE_FILTER_STRING] [--devbuild IS_DEV_BUILD] [--inactive] [--produce_apiview_artifact] [--repo REPO] [--build_id BUILD_ID] [glob_string] This is the primary entrypoint for the "build" action. This command is used to build any package within the azure-sdk-for- python repository. positional arguments: glob_string A comma separated list of glob strings that will target the top level directories that contain packages. Examples: All == "azure-*", Single = "azure-keyvault" options: -h, --help show this help message and exit -d DISTRIBUTION_DIRECTORY, --distribution-directory DISTRIBUTION_DIRECTORY The path to the distribution directory. Should be passed $(Build.ArtifactStagingDirectory) from the devops yaml definition.If that is not provided, will default to env variable SDK_ARTIFACT_DIRECTORY -> /.artifacts. --service SERVICE Name of service directory (under sdk/) to build.Example: --service applicationinsights --pkgfilter PACKAGE_FILTER_STRING An additional string used to filter the set of artifacts by a simple CONTAINS clause. This filters packages AFTER the set is built with compatibility and omission lists accounted. --devbuild IS_DEV_BUILD Set build type to dev build so package requirements will be updated if required package is not available on PyPI --inactive Include inactive packages when assembling artifacts. CI builds will include inactive packages as a way to ensure that the yml controlled artifacts can be associated with a wheel/sdist. --produce_apiview_artifact Should an additional build artifact that contains the targeted package + its direct dependencies be produced? --repo REPO Where is the start directory that we are building against? If not provided, the current working directory will be used. Please ensure you are within the azure-sdk-for-python repository. --build_id BUILD_ID The current build id. It not provided, will default through environment variables in the following order: GITHUB_RUN_ID -> BUILD_BUILDID -> SDK_BUILD_ID -> default value. ``` -------------------------------- ### Create and Get Liveness Session with Face Verification Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/face/azure-ai-vision-face/README.md This example demonstrates how to create a liveness detection session that also includes face verification against a provided image. You need to specify the path to the verification image. The results include both liveness and verification outcomes. ```python import uuid from azure.core.credentials import AzureKeyCredential from azure.ai.vision.face import FaceSessionClient from azure.ai.vision.face.models import CreateLivenessSessionContent, LivenessOperationMode endpoint = "" key = "" with FaceSessionClient(endpoint=endpoint, credential=AzureKeyCredential(key)) as face_session_client: sample_file_path = "" with open(sample_file_path, "rb") as fd: file_content = fd.read() # Create a session. print("Create a new liveness with verify session with verify image.") created_session = face_session_client.create_liveness_with_verify_session( CreateLivenessSessionContent( liveness_operation_mode=LivenessOperationMode.PASSIVE, device_correlation_id=str(uuid.uuid4()), send_results_to_client=False, auth_token_time_to_live_in_seconds=60, ), verify_image=file_content, ) print(f"Result: {created_session}") # Get the liveness detection and verification result. print("Get the liveness detection and verification result.") liveness_result = face_session_client.get_liveness_with_verify_session_result(created_session.session_id) print(f"Result: {liveness_result}") ``` -------------------------------- ### Install Development Requirements and Package with pip Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/dev_setup.md Install development requirements from 'dev_requirements.txt' and perform an editable install of the library using pip. This also installs 'azure-sdk-tools'. ```bash azure-sdk-for-python> cd sdk/formrecognizer/azure-ai-formrecognizer azure-sdk-for-python/sdk/formrecognizer/azure-ai-formrecognizer> pip install -r dev_requirements.txt azure-sdk-for-python/sdk/formrecognizer/azure-ai-formrecognizer> pip install -e . ``` -------------------------------- ### Run Configuring Metrics with Views Sample Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/metrics/README.md Execute the sample script for configuring metrics with views after setting the connection string. ```shell $ # from this directory $ python sample_views.py ``` -------------------------------- ### Install azure-ai-agentserver-invocations Source: https://github.com/azure/azure-sdk-for-python/blob/main/sdk/agentserver/azure-ai-agentserver-invocations/README.md Install the package using pip. This command also installs azure-ai-agentserver-core as a dependency. ```bash pip install azure-ai-agentserver-invocations ``` -------------------------------- ### Instantiate New Clients (After Migration) Source: https://github.com/azure/azure-sdk-for-python/blob/main/doc/dev/mgmt/azure_mgmt_web_migration.md Demonstrates how to instantiate clients from `azure-mgmt-certificateregistration` and `azure-mgmt-domainregistration` for specific operations. ```python from azure.mgmt.certificateregistration import CertificateRegistrationMgmtClient from azure.mgmt.domainregistration import DomainRegistrationMgmtClient # Client for certificate-related operations certificate_client = CertificateRegistrationMgmtClient(...) certificate_client.app_service_certificate_orders.list(...) # Client for domain-related operations domain_client = DomainRegistrationMgmtClient(...) domain_client.domain_registration_provider.list_operations(...) ```