You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/storage/files/storage-dotnet-how-to-use-files.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,15 +319,24 @@ To work with the code examples in this article, assign the Azure RBAC built-in r
319
319
320
320
An easy and secure way to authorize access and connect to Blob Storage is to obtain an OAuth token by creating a [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) instance. You can then use that credential to create a `ShareClient` object.
321
321
322
-
The following example creates a `ShareClient` object authorized using `DefaultAzureCredential`:
322
+
The following example creates a `ShareClient` object authorized using `DefaultAzureCredential`, then creates a `ShareDirectoryClient` object to work with a directory in the share:
323
323
324
324
```csharp
325
325
string accountName = "<account-name>";
326
326
string shareName = "<share-name>";
327
327
328
-
ShareClient client = new(
328
+
ShareClientOptions options = new ShareClientOptions()
329
+
{
330
+
AllowSourceTrailingDot = true,
331
+
AllowTrailingDot = true,
332
+
ShareTokenIntent = ShareTokenIntent.Backup,
333
+
};
334
+
ShareClient shareClient = new(
329
335
new Uri($"https://{accountName}.file.core.windows.net/{shareName}"),
If you know exactly which credential type you use to authenticate users, you can obtain an OAuth token by using other classes in the [Azure Identity client library for .NET](/dotnet/api/overview/azure/identity-readme). These classes derive from the [TokenCredential](/dotnet/api/azure.core.tokencredential) class.
@@ -367,7 +376,7 @@ For information about how to obtain account keys and best practice guidelines fo
367
376
368
377
To learn more about each of these authorization mechanisms, see [Choose how to authorize access to file data](authorize-data-operations-portal.md).
0 commit comments