diff --git a/sdk/communication/Azure.Communication.Email/README.md b/sdk/communication/Azure.Communication.Email/README.md index 7f26c6a9074a0..eb9264ea49764 100644 --- a/sdk/communication/Azure.Communication.Email/README.md +++ b/sdk/communication/Azure.Communication.Email/README.md @@ -38,8 +38,7 @@ Alternatively, Email clients can also be authenticated using a valid token crede ```C# Snippet:Azure_Communication_Email_CreateEmailClientWithToken string endpoint = ""; -TokenCredential tokenCredential = new DefaultAzureCredential(); -tokenCredential = new DefaultAzureCredential(); +var tokenCredential = new DefaultAzureCredential(); EmailClient emailClient = new EmailClient(new Uri(endpoint), tokenCredential); ``` ## Examples diff --git a/sdk/communication/Azure.Communication.Email/tests/EmailClientLiveTestBase.cs b/sdk/communication/Azure.Communication.Email/tests/EmailClientLiveTestBase.cs index ceb67ac889dd7..cb376d333e279 100644 --- a/sdk/communication/Azure.Communication.Email/tests/EmailClientLiveTestBase.cs +++ b/sdk/communication/Azure.Communication.Email/tests/EmailClientLiveTestBase.cs @@ -46,11 +46,10 @@ public EmailClient CreateSmsClientWithToken() } else { + tokenCredential = new DefaultAzureCredential(); #region Snippet:Azure_Communication_Email_CreateEmailClientWithToken //@@ string endpoint = ""; - //@@ TokenCredential tokenCredential = new DefaultAzureCredential(); - /*@@*/ - tokenCredential = new DefaultAzureCredential(); + //@@ var tokenCredential = new DefaultAzureCredential(); //@@ EmailClient emailClient = new EmailClient(new Uri(endpoint), tokenCredential); #endregion Snippet:Azure_Communication_Email_CreateEmailClientWithToken }