From 4019bf6de9bb47a0f34eb0f486721b4a82f2da8d Mon Sep 17 00:00:00 2001 From: Scott Addie Date: Thu, 12 Oct 2023 09:48:03 -0500 Subject: [PATCH] Document sovereign cloud support in LogsIngestionClient --- sdk/monitor/Azure.Monitor.Ingestion/README.md | 14 ++++++++++++++ .../tests/Samples/LogDataAndQuery.cs | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/sdk/monitor/Azure.Monitor.Ingestion/README.md b/sdk/monitor/Azure.Monitor.Ingestion/README.md index 9bbb43a15370d..a15eb9370509d 100644 --- a/sdk/monitor/Azure.Monitor.Ingestion/README.md +++ b/sdk/monitor/Azure.Monitor.Ingestion/README.md @@ -41,6 +41,20 @@ var credential = new DefaultAzureCredential(); var client = new LogsIngestionClient(endpoint, credential); ``` +#### Configure client for Azure sovereign cloud + +By default, `LogsIngestionClient` is configured to connect to the Azure public cloud. To connect to a sovereign cloud instead, set the `LogsIngestionClientOptions.Audience` property. For example: + +```C# Snippet:CreateLogsIngestionClientWithOptions +var endpoint = new Uri(""); +var credential = new DefaultAzureCredential(); +var clientOptions = new LogsIngestionClientOptions +{ + Audience = LogsIngestionAudience.AzureChina +}; +var client = new LogsIngestionClient(endpoint, credential, clientOptions); +``` + ### Upload the logs For examples of logs ingestion, see the [Examples](#examples) section. diff --git a/sdk/monitor/Azure.Monitor.Ingestion/tests/Samples/LogDataAndQuery.cs b/sdk/monitor/Azure.Monitor.Ingestion/tests/Samples/LogDataAndQuery.cs index d2088249e71ed..745306df60a4e 100644 --- a/sdk/monitor/Azure.Monitor.Ingestion/tests/Samples/LogDataAndQuery.cs +++ b/sdk/monitor/Azure.Monitor.Ingestion/tests/Samples/LogDataAndQuery.cs @@ -23,6 +23,19 @@ public void SetUpClient() #endregion } + public void SetUpClientWithOptions() + { + #region Snippet:CreateLogsIngestionClientWithOptions + var endpoint = new Uri(""); + var credential = new DefaultAzureCredential(); + var clientOptions = new LogsIngestionClientOptions + { + Audience = LogsIngestionAudience.AzureChina + }; + var client = new LogsIngestionClient(endpoint, credential, clientOptions); + #endregion + } + public void LogData() { #region Snippet:UploadCustomLogs