Skip to content

Commit f977492

Browse files
authored
Merge pull request #43667 from jongio/patch-4
Update code to remove StorageRequestFailedException
2 parents 0d31bca + c7c2922 commit f977492

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

articles/storage/common/storage-auth-aad-msi.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,13 @@ Install-Package Azure.Identity
118118
Add the following `using` directives to your code to use the Azure Identity and Azure Storage client libraries.
119119

120120
```csharp
121+
using Azure;
122+
using Azure.Identity;
123+
using Azure.Storage.Blobs;
121124
using System;
122125
using System.IO;
126+
using System.Text;
123127
using System.Threading.Tasks;
124-
using Azure.Identity;
125-
using Azure.Storage;
126-
using Azure.Storage.Sas;
127-
using Azure.Storage.Blobs;
128-
using Azure.Storage.Blobs.Models;
129128
```
130129

131130
To get a token credential that your code can use to authorize requests to Azure Storage, create an instance of the [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) class. The following code example shows how to get the authenticated token credential and use it to create a service client object, then use the service client to upload a new blob:
@@ -156,7 +155,7 @@ async static Task CreateBlockBlobAsync(string accountName, string containerName,
156155
await containerClient.UploadBlobAsync(blobName, stream);
157156
}
158157
}
159-
catch (StorageRequestFailedException e)
158+
catch (RequestFailedException e)
160159
{
161160
Console.WriteLine(e.Message);
162161
Console.ReadLine();

0 commit comments

Comments
 (0)