### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.eventgrid-readme.md Install the client library for .NET with NuGet. ```dotnetcli dotnet add package Azure.Provisioning.EventGrid ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.webpubsub-readme.md Install the client library for .NET with NuGet. ```dotnetcli dotnet add package Azure.Provisioning.WebPubSub ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.contentsafety-readme.md Install the client library for .NET using the NuGet package manager. ```bash dotnet add package Azure.AI.ContentSafety ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/messaging.webpubsub.client-readme.md Install the Azure.Messaging.WebPubSub.Client package using the .NET CLI. ```dotnetcli dotnet add package Azure.Messaging.WebPubSub.Client ``` -------------------------------- ### Install the Azure.Provisioning.ApplicationInsights Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.applicationinsights-readme.md Install the client library for .NET using NuGet. ```dotnetcli dotnet add package Azure.Provisioning.ApplicationInsights ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.webpubsub-readme.md Install the Microsoft Azure Web PubSub management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.WebPubSub ``` -------------------------------- ### Install Azure.Provisioning.PostgreSql Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.postgresql-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.PostgreSql ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.subscription-readme.md Install the Microsoft Azure Subscription management library for .NET using the .NET CLI. ```dotnetcli dotnet add package Azure.ResourceManager.Subscription ``` -------------------------------- ### Install Azure.Provisioning.Sql Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.sql-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.Sql ``` -------------------------------- ### Install the Azure.Provisioning.AppConfiguration Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.appconfiguration-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.AppConfiguration ``` -------------------------------- ### Install Azure.Provisioning.KeyVault Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.keyvault-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.KeyVault ``` -------------------------------- ### Install the Azure.Provisioning.Search Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.search-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.Search ``` -------------------------------- ### Install the Azure.Provisioning.ContainerRegistry Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.containerregistry-readme.md Use this command to install the client library for .NET using NuGet. ```dotnetcli dotnet add package Azure.Provisioning.ContainerRegistry ``` -------------------------------- ### Install System.ClientModel Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/system.clientmodel-readme.md Install the System.ClientModel client library for .NET using the .NET CLI. ```dotnetcli dotnet add package System.ClientModel ``` -------------------------------- ### Install the Azure.Provisioning.OperationalInsights package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.operationalinsights-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.OperationalInsights ``` -------------------------------- ### Install the VoiceLive client library for .NET Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.voicelive-readme.md Install the Azure.AI.VoiceLive package using the .NET CLI. ```dotnetcli dotnet add package Azure.AI.VoiceLive ``` -------------------------------- ### Install the PlanetaryComputer NuGet Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.planetarycomputer-readme.md Install the Azure.ResourceManager.PlanetaryComputer package using the .NET CLI. ```bash dotnet add package Azure.ResourceManager.PlanetaryComputer ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.logic-readme.md Install the Microsoft Azure Logic management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.Logic ``` -------------------------------- ### Install Azure.Provisioning.Storage with NuGet Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.storage-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.Storage ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.chaos-readme.md Install the Microsoft Azure Chaos management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.Chaos ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.storageactions-readme.md Install the Microsoft Azure Storage Actions management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.StorageActions ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.consumption-readme.md Install the Microsoft Azure Consumption management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.Consumption ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.powerbidedicated-readme.md Install the Microsoft Azure PowerBI Dedicated management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.PowerBIDicated ``` -------------------------------- ### Install the Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.providerhub-readme.md Install the Microsoft Azure Provider Hub management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.ProviderHub ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.compute-readme.md Install the Microsoft Azure Compute management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.Compute ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.workloads-readme.md Install the Microsoft Azure Workloads management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.Workloads ``` -------------------------------- ### Install Azure.Provisioning.SignalR Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.signalr-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.SignalR ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.sitemanager-readme.md Install the Microsoft Azure Site Manager management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.SiteManager ``` -------------------------------- ### Install Azure.Provisioning.CosmosDB with NuGet Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/provisioning.cosmosdb-readme.md Install the client library for .NET using the NuGet package manager. ```dotnetcli dotnet add package Azure.Provisioning.CosmosDB ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.communication-readme.md Install the Microsoft Azure Communication management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.Communication ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.costmanagement-readme.md Install the Microsoft Azure CostManagement management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.CostManagement ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.billing-readme.md Install the Microsoft Azure Billing management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.Billing ``` -------------------------------- ### Get an Order Item Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/edgeorder.md Example code demonstrating how to get an order item using the Azure.ResourceManager.EdgeOrder library. ```APIDOC ## Get an Order Item The following example gets an order item. ```csharp var armClient = new ArmClient(new DefaultAzureCredential()); Subscription subscription = armClient.GetDefaultSubscription(); ResourceGroup resourceGroup = subscription.GetResourceGroups().Get(resourceGroupName); OrderItemResourceCollection orderItemResourceCollection = resourceGroup.GetOrderItemResources(); OrderItemResource orderItemResource = orderItemResourceCollection.Get(orderItemName); ``` ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.postgresql-readme.md Install the Microsoft Azure Database for PostgreSQL management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.PostgreSql ``` -------------------------------- ### Install Web PubSub Extension Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.webjobs.extensions.webpubsub-readme.md Install the Web PubSub extension using the .NET CLI. ```dotnetcli dotnet add package Microsoft.Azure.WebJobs.Extensions.WebPubSub ``` -------------------------------- ### StartTime Property Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/add/metadata/Microsoft.WindowsAzure.Storage/OperationContext.meta.md Gets the start time of the operation. ```APIDOC ## StartTime Property ### Description Gets the start time of the operation. ### Property Type [DateTime Type] ``` -------------------------------- ### ListingContext.Marker Property Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/add/metadata/Microsoft.WindowsAzure.Storage.Shared.Protocol/ListingContext.meta.md Gets or sets the marker to start the listing from. ```APIDOC ## ListingContext.Marker Property ### Description Gets or sets the marker to start the listing from. ### Signature ```csharp public string Marker { get; set; } ``` ``` -------------------------------- ### FileRange.StartOffset Property Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/add/metadata/Microsoft.WindowsAzure.Storage.File/FileRange.meta.md Gets the starting offset of the file range. ```APIDOC ## FileRange.StartOffset ### Description Gets the starting offset of the file range. ### Property Value (System.Int64) - The starting offset of the file range. ``` -------------------------------- ### Install the Azure Mixed Reality Authentication client library Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/mixedreality.authentication-readme.md Install the library using the .NET CLI. ```dotnetcli dotnet add package Azure.MixedReality.Authentication ``` -------------------------------- ### PageRange.StartOffset Property Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/add/metadata/Microsoft.WindowsAzure.Storage.Blob/PageRange.meta.md Gets the start offset of the page range. ```APIDOC ## PageRange.StartOffset Property ### Description Gets the start offset of the page range. ### Signature ```csharp public long StartOffset { get; } ``` ### Return Value Returns a long representing the start offset of the page range. ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.datamigration-readme.md Install the Microsoft Azure Database Migration management library for .NET using the .NET CLI. ```dotnetcli dotnet add package Azure.ResourceManager.DataMigration ``` -------------------------------- ### SharedAccessTablePolicy.SharedAccessStartTime Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/add/metadata/Microsoft.WindowsAzure.Storage.Table/SharedAccessTablePolicy.meta.md Gets or sets the start time for the shared access policy. ```APIDOC ## SharedAccessTablePolicy.SharedAccessStartTime ### Description Gets or sets the start time for the shared access policy. ### Property Type System.Nullable ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.resourcemover-readme.md Install the Microsoft Azure Resource Mover management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.ResourceMover ``` -------------------------------- ### SharedAccessFilePolicy.SharedAccessStartTime Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/add/metadata/Microsoft.WindowsAzure.Storage.File/SharedAccessFilePolicy.meta.md Gets or sets the start time for the shared access policy. ```APIDOC ## SharedAccessFilePolicy.SharedAccessStartTime ### Description Gets or sets the start time for the shared access policy. ### Method Property (Get/Set) ### Endpoint N/A ### Parameters None ### Request Example None ### Response - **System.Nullable** (System.Nullable) - The start time for the shared access policy. ### Response Example None ``` -------------------------------- ### Install the Web PubSub extension package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.functions.worker.extensions.webpubsub-readme.md Install the client library from NuGet using the .NET CLI. ```dotnetcli dotnet add package Microsoft.Azure.Functions.Worker.Extensions.WebPubSub ``` -------------------------------- ### Install the Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.workloadssapvirtualinstance-readme.md Install the Microsoft Azure Workloads SapVirtualInstance management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.WorkloadsSapVirtualInstance ``` -------------------------------- ### Get Help for Azure Event Hubs Live Tests Setup Script Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.eventhubs-readme.md Use the -Help flag with the setup script to access information on its parameters and usage. ```powershell ./live-tests-azure-setup -Help ``` -------------------------------- ### Install the Microsoft Azure MySql management library for .NET Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.mysql-readme.md Install the library using the .NET CLI. ```dotnetcli dotnet add package Azure.ResourceManager.MySql ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.desktopvirtualization-readme.md Install the Microsoft Azure Desktop Virtualization management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.DesktopVirtualization ``` -------------------------------- ### Get a Chat Completion Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.openai-readme.md Instantiates an AzureOpenAIClient and uses it to get a chat completion from a specified deployment. This example demonstrates how to construct a chat conversation with system, user, and assistant messages. ```C# AzureOpenAIClient azureClient = new( new Uri("https://your-azure-openai-resource.com"), new DefaultAzureCredential()); ChatClient chatClient = azureClient.GetChatClient("my-gpt-35-turbo-deployment"); ChatCompletion completion = chatClient.CompleteChat( [ // System messages represent instructions or other guidance about how the assistant should behave new SystemChatMessage("You are a helpful assistant that talks like a pirate."), // User messages represent user input, whether historical or the most recent input new UserChatMessage("Hi, can you help me?"), // Assistant messages in a request represent conversation history for responses new AssistantChatMessage("Arrr! Of course, me hearty! What can I do for ye?"), new UserChatMessage("What's the best way to train a parrot?"), ]); Console.WriteLine($"{completion.Role}: {completion.Content[0].Text}"); ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.labservices-readme.md Install the Microsoft Azure Lab Services management library for .NET using NuGet. ```bash dotnet add package Azure.ResourceManager.LabServices ``` -------------------------------- ### Get a namespace Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.eventhubs-readme.md This example demonstrates how to retrieve a specific Event Hubs namespace by its name within a resource group. ```APIDOC ## Get a namespace ### Description This example demonstrates how to retrieve a specific Event Hubs namespace by its name within a resource group. ### Method ```C# EventHubsNamespaceCollection namespaceCollection = resourceGroup.GetEventHubsNamespaces(); EventHubsNamespaceResource eventHubNamespace = await namespaceCollection.GetAsync("myNamespace"); Console.WriteLine(eventHubNamespace.Id.Name); ``` ``` -------------------------------- ### Get all namespaces in a resource group Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.eventhubs-readme.md This example shows how to retrieve a collection of all Event Hubs namespaces within a specified resource group. ```APIDOC ## Get all namespaces in a resource group ### Description This example shows how to retrieve a collection of all Event Hubs namespaces within a specified resource group. ### Method ```C# EventHubsNamespaceCollection namespaceCollection = resourceGroup.GetEventHubsNamespaces(); await foreach (EventHubsNamespaceResource eventHubNamespace in namespaceCollection.GetAllAsync()) { Console.WriteLine(eventHubNamespace.Id.Name); } ``` ``` -------------------------------- ### Create and Start a Run Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.agents.persistent-readme.md Initiates a run for a thread against a specified agent. Additional instructions can be provided to guide the agent's response. ```C# ThreadRun run = await client.Runs.CreateRunAsync( thread.Id, agent.Id, additionalInstructions: "Please address the user as Jane Doe. The user has a premium account."); ``` -------------------------------- ### Example Token Issuance Start Event Payload Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.webjobs.extensions.authenticationevents-readme.md This JSON body imitates the request that Microsoft Entra ID sends to your REST API when a token issuance event starts. Use this payload with an API testing tool to simulate an incoming event. ```json { "type": "microsoft.graph.authenticationEvent.tokenIssuanceStart", "source": "/tenants/30000000-0000-0000-0000-000000000003/applications/40000000-0000-0000-0000-000000000002", "data": { "@odata.type": "microsoft.graph.onTokenIssuanceStartCalloutData", "tenantId": "30000000-0000-0000-0000-000000000003", "authenticationEventListenerId": "10000000-0000-0000-0000-000000000001", "customAuthenticationExtensionId": "10000000-0000-0000-0000-000000000002", "authenticationContext": { "correlationId": "20000000-0000-0000-0000-000000000002", "client": { "ip": "127.0.0.1", "locale": "en-us", "market": "en-us" }, "protocol": "OAUTH2.0", "clientServicePrincipal": { "id": "40000000-0000-0000-0000-000000000001", "appId": "40000000-0000-0000-0000-000000000002", "appDisplayName": "My Test application", "displayName": "My Test application" }, "resourceServicePrincipal": { "id": "40000000-0000-0000-0000-000000000003", "appId": "40000000-0000-0000-0000-000000000004", "appDisplayName": "My Test application", "displayName": "My Test application" }, "user": { "companyName": "Casey Jensen", "createdDateTime": "2023-08-16T00:00:00Z", "displayName": "Casey Jensen", "givenName": "Casey", "id": "60000000-0000-0000-0000-000000000006", "mail": "casey@contoso.com", "onPremisesSamAccountName": "Casey Jensen", "onPremisesSecurityIdentifier": "", "onPremisesUserPrincipalName": "Casey Jensen", "preferredLanguage": "en-us", "surname": "Jensen", "userPrincipalName": "casey@contoso.com", "userType": "Member" } } } } ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.networkfunction-readme.md Install the Microsoft Azure Network Function management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.NetworkFunction ``` -------------------------------- ### Create a RemoteRenderingClient with account key authentication Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/mixedreality.remoterendering-readme.md Use the AccountKeyCredential object to use an account identifier and account key to authenticate. This is useful for getting started quickly. ```csharp AzureKeyCredential accountKeyCredential = new AzureKeyCredential(accountKey); RemoteRenderingClient client = new RemoteRenderingClient(remoteRenderingEndpoint, accountId, accountDomain, accountKeyCredential); ``` -------------------------------- ### Get all rooms using RoomsClient Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/communication.rooms-readme.md Retrieve all valid rooms created under an ACS resource. This example shows how to paginate through the results and stop after a certain number of rooms. ```C# // Retrieve the first 2 pages of active rooms const int PageSize = 30; const int PageCount = 2; int maxRoomCount = PageCount * PageSize; int counter = 1; AsyncPageable allRooms = roomsClient.GetRoomsAsync(); await foreach (CommunicationRoom room in allRooms) { Console.WriteLine($"Room with id {room.Id} is valid from {room.ValidFrom} to {room.ValidUntil}."); counter++; if (counter == maxRoomCount) { break; } } ``` -------------------------------- ### Create DocumentIntelligenceClient with AzureKeyCredential Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.documentintelligence-readme.md Create a Document Intelligence client using an API key. This is a quick way to get started, but Microsoft Entra ID is recommended for production. ```C# string endpoint = ""; string apiKey = ""; var client = new DocumentIntelligenceClient(new Uri(endpoint), new AzureKeyCredential(apiKey)); ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.deviceprovisioningservices-readme.md Install the Microsoft Azure Device Provisioning Services management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.DeviceProvisioningServices ``` -------------------------------- ### Create Azure AI Search service using Azure CLI Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/search.documents-readme.md Create a free instance of Azure AI Search service using the Azure CLI. This is useful for getting started. ```powershell az search service create --name --resource-group --sku free --location westus ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.storagesync-readme.md Install the Microsoft Azure Storage / File Sync management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.StorageSync ``` -------------------------------- ### Delete and Purge Certificate Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/security.keyvault.certificates-readme.md Deletes all versions of a certificate. If soft-delete is enabled, the certificate is marked for deletion and can be purged or recovered. This example demonstrates starting the delete operation and then purging the deleted certificate. ```C# DeleteCertificateOperation operation = client.StartDeleteCertificate("MyCertificate"); // You only need to wait for completion if you want to purge or recover the certificate. // You should call `UpdateStatus` in another thread or after doing additional work like pumping messages. while (!operation.HasCompleted) { Thread.Sleep(2000); operation.UpdateStatus(); } DeletedCertificate certificate = operation.Value; client.PurgeDeletedCertificate(certificate.Name); ``` -------------------------------- ### List Recent Successful Conversions Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/mixedreality.remoterendering-readme.md Retrieves information about conversions, including those that have not started, are running, or have finished. This example lists the output URIs of successful conversions initiated within the last day. ```csharp foreach (var conversion in client.GetConversions()) { if ((conversion.Status == AssetConversionStatus.Succeeded) && (conversion.CreatedOn > DateTimeOffset.Now.AddDays(-1))) { Console.WriteLine($"output asset URI: {conversion.Output.OutputAssetUri}"); } } ``` -------------------------------- ### Get All Rooms Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/communication.rooms-readme.md Retrieve all valid rooms created under an ACS resource by calling the `GetRooms` or `GetRoomsAsync` function from `RoomsClient`. This example shows how to retrieve the first two pages of active rooms. ```APIDOC ## Get All Rooms ### Description Retrieve all valid rooms created under an ACS resource by calling the `GetRooms` or `GetRoomsAsync` function from `RoomsClient`. ### Method GET (implied by `GetRoomsAsync`) ### Endpoint Not explicitly defined, SDK method call. ### Parameters None explicitly defined for the SDK method call itself, but the operation is paginated. ### Request Example ```C# // Retrieve the first 2 pages of active rooms const int PageSize = 30; const int PageCount = 2; int maxRoomCount = PageCount * PageSize; int counter = 1; AsyncPageable allRooms = roomsClient.GetRoomsAsync(); await foreach (CommunicationRoom room in allRooms) { Console.WriteLine($"Room with id {room.Id} is valid from {room.ValidFrom} to {room.ValidUntil}."); counter++; if (counter == maxRoomCount) { break; } } ``` ### Response #### Success Response `AsyncPageable` containing a list of `CommunicationRoom` objects. #### Response Example ```json { "id": "string", "validFrom": "datetime", "validUntil": "datetime" } ``` ``` -------------------------------- ### Deserialize EventData with Avro using Schema Registry Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.data.schemaregistry.apacheavro-readme.md Consume an EventData event from an Event Hub and deserialize it back into an Employee object using the SchemaRegistryAvroSerializer. This example demonstrates the consumer setup and the deserialization process. ```C# // construct a consumer and consume the event from our event hub // It is recommended that you cache the Event Hubs clients for the lifetime of your // application, closing or disposing when application ends. This example disposes // after the immediate scope for simplicity. await using var consumer = new EventHubConsumerClient(EventHubConsumerClient.DefaultConsumerGroupName, fullyQualifiedNamespace, eventHubName, credential); await foreach (PartitionEvent receivedEvent in consumer.ReadEventsAsync()) { Employee deserialized = (Employee) await serializer.DeserializeAsync(eventData, typeof(Employee)); Console.WriteLine(deserialized.Age); Console.WriteLine(deserialized.Name); break; } ``` -------------------------------- ### Install the Web PubSub Common Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.webpubsub.common-readme.md Install the Microsoft.Azure.WebPubSub.Common client library using the .NET CLI. ```dotnetcli dotnet add package Microsoft.Azure.WebPubSub.Common ``` -------------------------------- ### Delete and Purge a Secret using Key Vault Secrets Client Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/security.keyvault.secrets-readme.md This example demonstrates how to start deleting a secret and then wait for the long-running operation to complete before purging it. You must wait for completion to purge or recover the secret. ```C# DeleteSecretOperation operation = client.StartDeleteSecret("secret-name"); // You only need to wait for completion if you want to purge or recover the secret. // You should call `UpdateStatus` in another thread or after doing additional work like pumping messages. while (!operation.HasCompleted) { Thread.Sleep(2000); operation.UpdateStatus(); } DeletedSecret secret = operation.Value; client.PurgeDeletedSecret(secret.Name); ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.hybridcompute-readme.md Install the Microsoft Azure Hybrid Compute management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.HybridCompute ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.hybridconnectivity-readme.md Install the Microsoft Azure Hybrid Connectivity management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.HybridConnectivity ``` -------------------------------- ### Retrieve Admin API Key using Azure CLI Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/search.documents-readme.md Retrieve the admin API key for an Azure AI Search service using the Azure CLI. Note: This retrieves an admin key for ease of getting started and should be managed carefully. ```powershell az search admin-key show --service-name --resource-group ``` -------------------------------- ### Install the Azure Web PubSub client library Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/messaging.webpubsub-readme.md Install the client library from NuGet. This is the first step to using the library in your .NET project. ```dotnetcli dotnet add package Azure.Messaging.WebPubSub ``` -------------------------------- ### Basic Voice Assistant Setup and Interaction Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.voicelive-readme.md This snippet demonstrates how to initialize the VoiceLive client, start a session, configure it for a voice conversation with specific options like model, instructions, voice, and turn detection, and process audio and text responses. ```C# // Create the VoiceLive client Uri endpoint = new Uri("https://your-resource.cognitiveservices.azure.com"); DefaultAzureCredential credential = new DefaultAzureCredential(); VoiceLiveClient client = new VoiceLiveClient(endpoint, credential); var model = "gpt-realtime"; // Specify the model to use // Start a new session VoiceLiveSession session = await client.StartSessionAsync(model).ConfigureAwait(false); // Configure session for voice conversation VoiceLiveSessionOptions sessionOptions = new() { Model = model, Instructions = "You are a helpful AI assistant. Respond naturally and conversationally.", Voice = new AzureStandardVoice("en-US-AvaNeural"), TurnDetection = new AzureSemanticVadTurnDetection() { Threshold = 0.5f, PrefixPadding = TimeSpan.FromMilliseconds(300), SilenceDuration = TimeSpan.FromMilliseconds(500) }, InputAudioFormat = InputAudioFormat.Pcm16, OutputAudioFormat = OutputAudioFormat.Pcm16 }; // Ensure modalities include audio sessionOptions.Modalities.Clear(); sessionOptions.Modalities.Add(InteractionModality.Text); sessionOptions.Modalities.Add(InteractionModality.Audio); await session.ConfigureSessionAsync(sessionOptions).ConfigureAwait(false); // Process events from the session await foreach (SessionUpdate serverEvent in session.GetUpdatesAsync().ConfigureAwait(false)) { if (serverEvent is SessionUpdateResponseAudioDelta audioDelta) { // Play audio response byte[] audioData = audioDelta.Delta.ToArray(); // ... audio playback logic } else if (serverEvent is SessionUpdateResponseTextDelta textDelta) { // Display text response Console.Write(textDelta.Delta); } } ``` -------------------------------- ### Get an Order Item using Azure SDK for .NET Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/edgeorder.md This C# code example demonstrates how to retrieve an existing order item using the Azure SDK for .NET. It requires authentication with Azure and access to the subscription and resource group where the order item resides. ```csharp var armClient = new ArmClient(new DefaultAzureCredential()); Subscription subscription = armClient.GetDefaultSubscription(); ResourceGroup resourceGroup = subscription.GetResourceGroups().Get(resourceGroupName); OrderItemResourceCollection orderItemResourceCollection = resourceGroup.GetOrderItemResources(); OrderItemResource orderItemResource = orderItemResourceCollection.Get(orderItemName); ``` -------------------------------- ### Handle Polling for Azure Function Runs Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.agents.persistent-readme.md Initiate a run with an agent that uses Azure Functions and poll its status until completion or requires action. This example demonstrates creating a thread, sending a user message, starting a run, and checking the run status in a loop. ```C# PersistentAgentThread thread = await client.Threads.CreateThreadAsync(); PersistentThreadMessage message = await client.Messages.CreateMessageAsync( thread.Id, MessageRole.User, "What is the most prevalent element in the universe? What would foo say?"); ThreadRun run = await client.Runs.CreateRunAsync(thread, agent); do { await Task.Delay(TimeSpan.FromMilliseconds(500)); run = await client.Runs.GetRunAsync(thread.Id, run.Id); } while (run.Status == RunStatus.Queued || run.Status == RunStatus.InProgress || run.Status == RunStatus.RequiresAction); Assert.AreEqual( RunStatus.Completed, run.Status, run.LastError?.Message); ``` -------------------------------- ### Create a SearchClient with Microsoft Entra ID Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/search.documents-readme.md Instantiate a SearchClient using Microsoft Entra ID authentication. This example uses DefaultAzureCredential, which supports various authentication methods like Managed Identity or service principals. Ensure the Azure.Identity package is installed and necessary environment variables are set. ```APIDOC ## Create a client using Microsoft Entra ID authentication You can also create a `SearchClient`, `SearchIndexClient`, or `SearchIndexerClient` using Microsoft Entra ID authentication. Your user or service principal must be assigned the "Search Index Data Reader" role. Using the [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Search.Documents_12.0.0/sdk/identity/Azure.Identity/README.md#defaultazurecredential) you can authenticate a service using Managed Identity or a service principal, authenticate as a developer working on an application, and more all without changing code. Please refer the [documentation](https://learn.microsoft.com/azure/search/search-security-rbac?tabs=config-svc-portal%2Croles-portal%2Ctest-portal%2Ccustom-role-portal%2Cdisable-keys-portal) for instructions on how to connect to Azure AI Search using Azure role-based access control (Azure RBAC). Before you can use the `DefaultAzureCredential`, or any credential type from [Azure.Identity](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Search.Documents_12.0.0/sdk/identity/Azure.Identity/README.md), you'll first need to [install the Azure.Identity package](https://github.com/Azure/azure-sdk-for-net/blob/Azure.Search.Documents_12.0.0/sdk/identity/Azure.Identity/README.md#install-the-package). To use `DefaultAzureCredential` with a client ID and secret, you'll need to set the `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, and `AZURE_CLIENT_SECRET` environment variables; alternatively, you can pass those values to the `ClientSecretCredential` also in Azure.Identity. Make sure you use the right namespace for `DefaultAzureCredential` at the top of your source file: ```C# Snippet:Azure_Search_Readme_Identity_Namespace using Azure.Identity; ``` Then you can create an instance of `DefaultAzureCredential` and pass it to a new instance of your client: ```C# Snippet:Azure_Search_Readme_CreateWithDefaultAzureCredential string indexName = "nycjobs"; // Get the service endpoint from the environment Uri endpoint = new Uri(Environment.GetEnvironmentVariable("SEARCH_ENDPOINT")); DefaultAzureCredential credential = new DefaultAzureCredential(); // Create a client SearchClient client = new SearchClient(endpoint, indexName, credential); ``` ``` -------------------------------- ### Install the Content Understanding client library Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.contentunderstanding-readme.md Install the .NET client library for Azure AI Content Understanding using the NuGet package manager. ```bash dotnet add package Azure.AI.ContentUnderstanding ``` -------------------------------- ### Install the client library using .NET CLI Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.webpubsub.aspnetcore-readme.md Install the Microsoft.Azure.WebPubSub.AspNetCore NuGet package using the dotnet add package command. ```powershell dotnet add package Microsoft.Azure.WebPubSub.AspNetCore ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.appconfiguration-readme.md Install the Microsoft Azure App Configuration management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.AppConfiguration ``` -------------------------------- ### Get Application Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/compute.batch-readme.md `GetApplication` can be used to get a `BatchApplication` object. ```APIDOC ## Get Application ### Description Retrieves a specific `BatchApplication` object using its ID. ### Method Signature `BatchApplication GetApplication(string applicationId)` ### Parameters #### Path Parameters - **applicationId** (string) - Required - The ID of the application to retrieve. ### Request Example ```csharp BatchClient batchClient = new BatchClient( new Uri("https://.eastus.batch.azure.com"), new DefaultAzureCredential()); BatchApplication application = batchClient.GetApplication("appID"); ``` ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.cosmosdb-readme.md Install the Microsoft Azure Cosmos DB management library for .NET using the .NET CLI. ```dotnetcli dotnet add package Azure.ResourceManager.CosmosDB ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.dataprotectionbackup-readme.md Install the Microsoft Azure Data Protection Backup management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.DataProtectionBackup ``` -------------------------------- ### Install the DisconnectedOperations NuGet Package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.disconnectedoperations-readme.md Install the Microsoft Azure DisconnectedOperations management library for .NET using NuGet. Use the --prerelease flag to install the beta version. ```dotnetcli dotnet add package Azure.ResourceManager.DisconnectedOperations ``` ```dotnetcli dotnet add package Azure.ResourceManager.DisconnectedOperations --prerelease ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.eventgrid-readme.md Install the Microsoft Azure Event Grid management library for .NET using NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.EventGrid ``` -------------------------------- ### Install OpenTelemetry.Exporter.Console Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/ai.projects.agents-readme.md Install the OpenTelemetry.Exporter.Console package using NuGet for tracing to the console. ```dotnetcli dotnet add package OpenTelemetry.Exporter.Console ``` -------------------------------- ### Install the package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/resourcemanager.managednetworkfabric-readme.md Install the Microsoft Azure Azure.ResourceManager.ManagedNetworkFabric management library for .NET with NuGet. ```dotnetcli dotnet add package Azure.ResourceManager.ManagedNetworkFabric ``` -------------------------------- ### Install Newtonsoft.Json support package Source: https://github.com/microsoftdocs/azure-docs-sdk-dotnet/blob/main/api/overview/azure/latest/microsoft.azure.core.newtonsoftjson-readme.md Install the Microsoft.Azure.Core.NewtonsoftJson package using the .NET CLI. ```dotnetcli dotnet add package Microsoft.Azure.Core.NewtonsoftJson ```