### Install the azure-messaging-webpubsubclient package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/messaging-webpubsubclient-readme.md Install the client library using pip. ```bash pip install azure-messaging-webpubsubclient ``` -------------------------------- ### Install Azure SDK Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-planetarycomputer-readme.md Install the Planetary Computer management client and the identity library using pip. Ensure Python 3.9+ is installed. ```bash pip install azure-mgmt-planetarycomputer pip install azure-identity ``` -------------------------------- ### Install SDK and Dependencies Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-contentunderstanding-readme.md Installs the Azure AI Content Understanding SDK and development dependencies. Ensure you have pip installed. ```bash 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 ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/schemaregistry-readme.md Install the Azure Schema Registry client library for Python using pip. ```Bash pip install azure-schemaregistry ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-workloadssapvirtualinstance-readme.md Install the Workloadssapvirtualinstance management client library and the Azure identity library using pip. ```bash pip install azure-mgmt-workloadssapvirtualinstance pip install azure-identity ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/eventhub-checkpointstoreblob-readme.md Install the azure-eventhub-checkpointstoreblob package using pip. ```bash pip install azure-eventhub-checkpointstoreblob ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/servicebus-readme.md Install the Azure Service Bus client library for Python using pip. ```Bash pip install azure-servicebus ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/communication-rooms-readme.md Install the Azure Communication Rooms client library for Python using pip. ```bash python -m pip install azure-communication-rooms ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-documentintelligence-readme.md Install the azure-ai-documentintelligence package using pip. ```bash python -m pip install azure-ai-documentintelligence ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/monitor-query-readme.md Install the Azure Monitor Query client library for Python using pip. ```bash pip install azure-monitor-query ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/messaging-webpubsubservice-readme.md Install the Azure Web PubSub service client library for Python using pip. ```bash python -m pip install azure-messaging-webpubsubservice ``` -------------------------------- ### Install the Azure Communication JobRouter client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/communication-jobrouter-readme.md Install the library using pip. ```bash pip install azure-communication-jobrouter ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-contentunderstanding-readme.md Install the client library for Python with pip. Python 3.9 or later is required. ```bash python -m pip install azure-ai-contentunderstanding ``` -------------------------------- ### Install Azure Planetary Computer SDK Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/planetarycomputer-readme.md Install the azure-planetarycomputer package using pip. ```bash python -m pip install azure-planetarycomputer ``` -------------------------------- ### Install azure-postgresql-auth Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/postgresql-auth-readme.md Install the core package for Azure PostgreSQL authentication. ```bash pip install azure-postgresql-auth ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/eventhub-checkpointstoreblob-aio-readme.md Install the asynchronous Event Hubs Checkpoint Store Blob package using pip. ```bash $ pip install azure-eventhub-checkpointstoreblob-aio ``` -------------------------------- ### Install Azure Scheduler SDK Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/scheduler.md Install the Azure Scheduler management library using pip. ```bash pip install azure-mgmt-scheduler ``` -------------------------------- ### Install Azure Reservations SDK Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-reservations-readme.md Install the necessary packages for the Azure Reservations client library and identity management. ```bash pip install azure-mgmt-reservations pip install azure-identity ``` -------------------------------- ### Install with psycopg3 extras Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/postgresql-auth-readme.md Install the package with support for the psycopg3 driver, recommended for new projects. ```bash pip install "azure-postgresql-auth[psycopg3]" ``` -------------------------------- ### Install azure-identity-broker Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/identity-broker-readme.md Install the Azure Identity Broker plugin for Python using pip. ```bash pip install azure-identity-broker ``` -------------------------------- ### Install Azure Blob Storage Client Library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/storage.md Installs the azure-storage-blob package using pip. ```bash pip install azure-storage-blob ``` -------------------------------- ### Install the Azure AI Content Safety library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-contentsafety-readme.md Install the package using pip. ```bash pip install azure-ai-contentsafety ``` -------------------------------- ### Install Azure Resource Management Libraries Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/resources.md Install the necessary Azure SDK libraries for resource management and authentication. ```bash pip install azure-mgmt-resource pip install azure-identity ``` -------------------------------- ### Install the Azure Schema Registry Avro Encoder client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/schemaregistry-avroencoder-readme.md Install the package using pip. ```Bash pip install azure-schemaregistry-avroencoder ``` -------------------------------- ### Install Azure Site Manager SDK Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-sitemanager-readme.md Install the necessary packages for the Azure Site Manager SDK and authentication. ```bash pip install azure-mgmt-sitemanager pip install azure-identity ``` -------------------------------- ### Install Storagemover Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-storagemover-readme.md Install the necessary packages for the Storagemover Management client library and Azure identity. ```bash pip install azure-mgmt-storagemover pip install azure-identity ``` -------------------------------- ### Get a secret Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/keyvault-secrets-readme.md Retrieves a secret from the Key Vault. This example demonstrates handling a ResourceNotFoundError if the secret does not exist. ```APIDOC ## Get a secret ### Description Retrieves a secret from the Key Vault. This example demonstrates handling a `ResourceNotFoundError` if the secret does not exist. ### Method `get_secret` ### Parameters - **secret_name** (str) - The name of the secret to retrieve. ### Request Example ```python from azure.identity import DefaultAzureCredential from azure.keyvault.secrets import SecretClient from azure.core.exceptions import ResourceNotFoundError credential = DefaultAzureCredential() secret_client = SecretClient(vault_url="https://my-key-vault.vault.azure.net/", credential=credential) try: secret_client.get_secret("which-does-not-exist") except ResourceNotFoundError as e: print(e.message) ``` ### Response #### Success Response (200) Returns the secret object if found. #### Error Response - **ResourceNotFoundError**: Raised if the secret does not exist in the vault. #### Response Example (Success) ```python # If secret exists, this would print secret details # print(secret.name) # print(secret.value) ``` #### Response Example (Error) ```python # Output from the error handling example Message indicating the resource was not found. ``` ``` -------------------------------- ### Set up virtual environment for running samples Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-contentunderstanding-readme.md This bash script demonstrates how to set up a Python virtual environment for running the Content Understanding SDK samples. It includes navigating to the package directory, creating a virtual environment, and activating it for both Linux/macOS and Windows. ```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 ``` -------------------------------- ### Load Configuration with Startup Timeout Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/appconfiguration-provider-readme.md Illustrates how to configure a custom startup timeout for the provider. This example sets the timeout to 200 seconds, overriding the default 100 seconds. ```python from azure.appconfiguration.provider import load config = load(endpoint=endpoint, credential=credential, startup_timeout=200, **kwargs) ``` -------------------------------- ### Query logs with a specified timespan Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/monitor-query-readme.md This example shows how to query logs from a Log Analytics workspace and specifies the time range for the query using a start and end datetime. ```APIDOC ## query_workspace with timespan ### Description Queries logs from a Log Analytics workspace with a specified time range. ### Method client.query_workspace ### Parameters #### Path Parameters - **workspace_id** (str) - Required - The ID of the Log Analytics workspace. - **query** (str) - Required - The query to execute. - **timespan** (tuple) - Required - A tuple containing the start and end datetime objects for the query. ### Request Example ```python import os import pandas as pd from datetime import datetime, timezone from azure.monitor.query import LogsQueryClient, LogsQueryResult from azure.identity import DefaultAzureCredential from azure.core.exceptions import HttpResponseError credential = DefaultAzureCredential() client = LogsQueryClient(credential) query = """AppRequests | take 5""" start_time=datetime(2021, 7, 2, tzinfo=timezone.utc) end_time=datetime(2021, 7, 4, tzinfo=timezone.utc) try: response = client.query_workspace( workspace_id=os.environ['LOG_WORKSPACE_ID'], query=query, timespan=(start_time, end_time) ) if response.status == LogsQueryStatus.SUCCESS: data = response.tables else: # LogsQueryPartialResult error = response.partial_error data = response.partial_data print(error) for table in data: df = pd.DataFrame(data=table.rows, columns=table.columns) print(df) except HttpResponseError as err: print("something fatal happened") print(err) ``` ### Response #### Success Response (LogsQuerySuccess) - **status** (LogsQueryStatus) - The status of the query. - **tables** (list) - A list of tables containing the query results. #### Partial Success Response (LogsQueryPartialResult) - **status** (LogsQueryStatus) - The status of the query. - **partial_error** (Exception) - The error encountered during the query. - **partial_data** (list) - The partial data returned before the error occurred. #### Response Example ```json { "status": "LogsQueryStatus.SUCCESS", "tables": [ { "rows": [ [ "value1", "value2" ] ], "columns": [ "Column1", "Column2" ] } ] } ``` ``` -------------------------------- ### Install Containerservicefleet and Identity Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-containerservicefleet-readme.md Install the necessary Python packages for Containerservicefleet management and identity authentication. ```bash pip install azure-mgmt-containerservicefleet pip install azure-identity ``` -------------------------------- ### Get relay configuration with nearest route type Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/communication-networktraversal-readme.md Obtain relay configuration for a specific user, prioritizing the nearest route type. This example demonstrates setting the `route_type` parameter to `RouteType.NEAREST`. ```python # We need a user from Identity user = identity_client.create_user() relay_configuration = relay_client.get_relay_configuration(user=user, route_type=RouteType.NEAREST) for iceServer in config.ice_servers: assert iceServer.username is not None print('Username: ' + iceServer.username) assert iceServer.credential is not None print('Credential: ' + iceServer.credential) assert iceServer.urls is not None for url in iceServer.urls: print('Url:' + url) ``` -------------------------------- ### Create a chat thread with participants and idempotency token Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/communication-chat-readme.md This example demonstrates creating a chat thread with specified participants and an idempotency token for request uniqueness. It includes setup for `CommunicationIdentityClient` and `ChatClient`. ```python # With idempotency_token and thread_participants from azure.communication.identity import CommunicationIdentityClient from azure.communication.chat import ChatParticipant, ChatClient, CommunicationTokenCredential import uuid from datetime import datetime # create an user identity_client = CommunicationIdentityClient.from_connection_string('') user = identity_client.create_user() # user access tokens tokenresponse = identity_client.get_token(user, scopes=["chat"]) token = tokenresponse.token ## OR pass existing user # from azure.communication.chat import CommunicationUserIdentifier # user_id = 'some_user_id' # user = CommunicationUserIdentifier(user_id) # create the chat_client endpoint = "https://.communcationservices.azure.com" chat_client = ChatClient(endpoint, CommunicationTokenCredential(token)) # modify function to implement customer logic def get_unique_identifier_for_request(**kwargs): res = uuid.uuid4() return res topic = "test topic" thread_participants = [ChatParticipant( identifier=user, display_name='name', share_history_time=datetime.utcnow() )] # obtains idempotency_token using some customer logic idempotency_token = get_unique_identifier_for_request() create_chat_thread_result = chat_client.create_chat_thread( topic, thread_participants=thread_participants, idempotency_token=idempotency_token) thread_id = create_chat_thread_result.chat_thread.id # fetch ChatThreadClient chat_thread_client = chat_client.get_chat_thread_client(create_chat_thread_result.chat_thread.id) # Additionally, you can also check if all participants were successfully added or not ``` -------------------------------- ### Manually instrumenting an application with OpenTelemetry Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/monitor-opentelemetry-readme.md This example demonstrates how to manually instrument an application using OpenTelemetry, which can be useful if you need to add support for instrumentations not bundled with the Azure Monitor distro. Ensure you have the necessary OpenTelemetry libraries installed. ```python from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter # Set up TracerProvider tracer_provider = TracerProvider() # Set up Azure Monitor exporter exporter = AzureMonitorTraceExporter(connection_string="") tracer_provider.add_span_processor(BatchSpanProcessor(exporter)) # Set the global TracerProvider trace.set_tracer_provider(tracer_provider) # Get a tracer tracer = trace.get_tracer(__name__) # Example usage: create a span with tracer.start_as_current_span("sample_span"): print("Hello, World!") ``` -------------------------------- ### Run Sync Samples Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-contentunderstanding-readme.md Navigate to the samples directory and run sync samples using Python. Ensure your virtual environment is activated. ```bash # Make sure virtual environment is activated source .venv/bin/activate # Linux/macOS # .venv\Scripts\activate # Windows # Navigate to samples directory cd samples # Run sync samples python sample_analyze_url.py python sample_analyze_binary.py ``` -------------------------------- ### Install Azure Batch Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-batch-readme.md Install the azure-mgmt-batch and azure-identity packages using pip. Ensure Python 3.7+ is installed. ```bash pip install azure-mgmt-batch pip install azure-identity ``` -------------------------------- ### Install Azure SDK Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-mongocluster-readme.md Install the necessary Azure SDK packages for Python using pip. Ensure Python 3.9+ is installed. ```bash pip install azure-mgmt-mongocluster pip install azure-identity ``` -------------------------------- ### Install Azure Load Testing client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/developer-loadtesting-readme.md Install the azure-developer-loadtesting package using pip. Ensure Python 3.7 or later is installed. ```bash python -m pip install azure-developer-loadtesting ``` -------------------------------- ### Install Azure Standbypool Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-standbypool-readme.md Install the necessary packages for Azure Standbypool management using pip. Ensure Python 3.9+ is installed. ```bash pip install azure-mgmt-standbypool pip install azure-identity ``` -------------------------------- ### Install the Azure Communication Administration client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/communication-administration-readme-pre.md Install the library using pip. This is a prerequisite for using the client library. ```bash pip install azure-communication-administration ``` -------------------------------- ### Install Azure Compute Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-compute-readme.md Install the necessary Azure SDK packages for Python Compute Management. Ensure Python 3.9+ is installed. ```bash pip install azure-mgmt-compute pip install azure-identity ``` -------------------------------- ### Install Azure Management Front Door and Identity Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-frontdoor-readme.md Install the necessary Azure SDK packages for managing Front Door and handling authentication. ```bash pip install azure-mgmt-frontdoor pip install azure-identity ``` -------------------------------- ### Install Azure ApiCenter Management SDK Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-apicenter-readme.md Installs the necessary packages for Azure ApiCenter management using pip. Ensure Python 3.8+ is installed. ```bash pip install azure-mgmt-apicenter pip install azure-identity ``` -------------------------------- ### Run Async Samples Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-contentunderstanding-readme.md Navigate to the async_samples directory and run async samples using Python. Ensure your virtual environment is activated. ```bash # Make sure virtual environment is activated source .venv/bin/activate # Navigate to async_samples directory cd samples/async_samples ``` -------------------------------- ### Install Azure Informaticadatamanagement Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-informaticadatamanagement-readme.md Install the necessary packages for managing Azure Informaticadatamanagement resources using Python. Ensure Python 3.8+ is installed. ```bash pip install azure-mgmt-informaticadatamanagement pip install azure-identity ``` -------------------------------- ### Install Base Azure AI VoiceLive Client Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-voicelive-readme.md Install the core client library for Azure AI VoiceLive. ```bash python -m pip install azure-ai-voicelive ``` -------------------------------- ### Install Connected VMware Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-connectedvmware-readme.md Install the necessary packages for managing Connected VMware resources using pip. Ensure Python 3.7+ is installed. ```bash pip install azure-mgmt-connectedvmware pip install azure-identity ``` -------------------------------- ### Install Azure ML client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-ml-readme.md Install the Azure ML client library for Python using pip. It is recommended to also install azure-identity for authentication. ```bash pip install azure-ai-ml pip install azure-identity ``` -------------------------------- ### Install Azure SDK for Python Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-purestorageblock-readme.md Install the PureStorageBlock management client and the identity library using pip. ```bash pip install azure-mgmt-purestorageblock pip install azure-identity ``` -------------------------------- ### Create a Batch Pool with Linux Nodes Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/batch.md Example of setting up a pool of Linux compute nodes in a Batch account using the client library. Requires Batch account credentials and URL. ```python import azure.batch from azure.batch import batch_auth, BatchServiceClient, models # create the batch client for an account using its URI and keys creds = batch_auth.SharedKeyCredentials(account, key) client = BatchServiceClient(creds, batch_url) # Create the VirtualMachineConfiguration, specifying # the VM image reference and the Batch node agent to # be installed on the node. vmc = models.VirtualMachineConfiguration( image_reference = models.ImageReference( publisher='Canonical', offer='UbuntuServer', sku='18.04-LTS' ), node_agent_sku_id = "batch.node.ubuntu 18.04") # Assign the virtual machine configuration to the pool new_pool = models.PoolAddParameter( id = 'new_pool', vm_size='standard_d2_v2', virtual_machine_configuration = vmc ) # Create pool in the Batch service client.pool.add(new_pool) ``` -------------------------------- ### Install the Azure Monitor Query Metrics client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/monitor-querymetrics-readme.md Install the library using pip. Ensure you have Python 3.9 or later. ```bash pip install azure-monitor-querymetrics ``` -------------------------------- ### Install Azure SDK for Python Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-paloaltonetworksngfw-readme.md Installs the Palo Alto Networks NGFW Management client library and the Azure Identity library. Ensure Python 3.7+ is installed. ```bash pip install azure-mgmt-paloaltonetworksngfw pip install azure-identity ``` -------------------------------- ### Install Network Cloud Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-networkcloud-readme.md Install the Network Cloud Management client library and the Azure identity library using pip. Ensure Python 3.9+ is installed. ```bash pip install azure-mgmt-networkcloud pip install azure-identity ``` -------------------------------- ### Install Azure Databricks Management Client Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-databricks-readme.md Install the necessary packages for managing Azure Databricks resources using the Azure SDK for Python. Ensure Python 3.7+ is installed. ```bash pip install azure-mgmt-databricks pip install azure-identity ``` -------------------------------- ### Run Chat Client Samples Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/communication-chat-readme.md Executes synchronous and asynchronous chat client sample applications. ```bash python samples\chat_client_sample.py python samples\chat_client_sample_async.py ``` -------------------------------- ### Initialize and Run Simulator Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-evaluation-readme.md Initialize the `Simulator` with model configuration and run it with a target callback function and conversation turns. Outputs are saved to a JSONL file. ```python from azure.ai.evaluation.simulator import Simulator model_config = { "azure_endpoint": os.environ.get("AZURE_ENDPOINT"), "azure_deployment": os.environ.get("AZURE_DEPLOYMENT_NAME"), "api_version": os.environ.get("AZURE_API_VERSION"), } custom_simulator = Simulator(model_config=model_config) outputs = asyncio.run(custom_simulator( target=callback, conversation_turns=[ [ "What should I know about the public gardens in the US?", ], [ "How do I simulate data against LLMs", ], ], max_conversation_turns=2, )) with open("simulator_output.jsonl", "w") as f: for output in outputs: f.write(output.to_eval_qr_json_lines()) ``` -------------------------------- ### Get Purchased Phone Number Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/communication-phonenumbers-readme.md Gets the information from the specified phone number. ```APIDOC ## Get Purchased Phone Number ### Description Gets the information from the specified phone number. ### Method ```python phone_numbers_client.get_purchased_phone_number("") ``` ### Response Example ```python result = phone_numbers_client.get_purchased_phone_number("") print(result.country_code) print(result.phone_number) ``` ``` -------------------------------- ### Install Azure DataLake Storage client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/storage-file-datalake-readme.md Install the Azure DataLake Storage client library for Python using pip. The --pre flag installs the latest pre-release version. ```bash pip install azure-storage-file-datalake --pre ``` -------------------------------- ### Create Cosmos Client with Account Key Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/cosmos-readme.md Instantiate the CosmosClient using the account URI and primary master key retrieved from environment variables. Ensure ACCOUNT_URI and ACCOUNT_KEY are set. ```python from azure.cosmos import CosmosClient import os URL = os.environ['ACCOUNT_URI'] KEY = os.environ['ACCOUNT_KEY'] client = CosmosClient(URL, credential=KEY) ``` -------------------------------- ### Install Azure Arc Data Management and Azure Identity Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-azurearcdata-readme.md Install the necessary Python packages for Azure Arc Data Management and Azure Identity. Ensure you have Python 3.10+ installed. ```bash pip install azure-mgmt-azurearcdata pip install azure-identity ``` -------------------------------- ### Install Azure AI VoiceLive with Voice Samples Support Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-voicelive-readme.md Install the Azure AI VoiceLive client with aiohttp and PyAudio for voice samples. Ensure PyAudio dependencies are installed for your platform first. ```bash python -m pip install azure-ai-voicelive[aiohttp] pyaudio python-dotenv ``` -------------------------------- ### Install Azure SDK Packages Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-mysqlflexibleservers-readme.md Install the necessary Azure SDK packages for managing MySQL Flexible Servers and for authentication. ```bash pip install azure-mgmt-mysqlflexibleservers pip install azure-identity ``` -------------------------------- ### Install Azure Storage Management Library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/storage.md Installs the azure-mgmt-storage package using pip. ```bash pip install azure-mgmt-storage ``` -------------------------------- ### Install with SQLAlchemy extras Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/postgresql-auth-readme.md Install the package with support for SQLAlchemy for ORM/Core interface integration. ```bash pip install "azure-postgresql-auth[sqlalchemy]" ``` -------------------------------- ### Install Azure Data Lake Store Client Library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/data-lake-storage-(gen-1).md Use this command to install the client library for interacting with Azure Data Lake Storage (Gen 1) data. ```bash pip install azure-datalake-store ``` -------------------------------- ### Install with psycopg2 extras Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/postgresql-auth-readme.md Install the package with support for the psycopg2 driver for legacy projects. ```bash pip install "azure-postgresql-auth[psycopg2]" ``` -------------------------------- ### Install the Azure Storage Queues client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/storage-queue-readme.md Install the Azure Storage Queues client library for Python using pip. ```bash pip install azure-storage-queue ``` -------------------------------- ### Install SCVMM Management Package Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/mgmt-scvmm-readme.md Install the azure-mgmt-scvmm and azure-identity packages using pip. ```bash pip install azure-mgmt-scvmm pip install azure-identity ``` -------------------------------- ### Install Azure App Configuration SDK Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/appconfiguration-readme.md Install the Azure App Configuration client library for Python using pip. ```bash pip install azure-appconfiguration ``` -------------------------------- ### Install the Azure Monitor Ingestion client library Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/monitor-ingestion-readme.md Install the library using pip. Ensure you have Python 3.9 or later. ```bash pip install azure-monitor-ingestion ``` -------------------------------- ### Create a New Project Source: https://github.com/microsoftdocs/azure-docs-sdk-python/blob/main/docs-ref-services/latest/ai-language-questionanswering-readme.md This snippet demonstrates the initialization of the AuthoringClient for managing Question Answering projects. It requires Azure endpoint and key. ```python import os from azure.core.credentials import AzureKeyCredential from azure.ai.language.questionanswering.authoring import AuthoringClient ```