Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See https://github.com/tamram/storage-dotnet-azure-ad-msal/tree/tamram-0818 ``` [AuthorizeForScopes(Scopes = new string[] { "https://storage.azure.com/user_impersonation" })] public async Task<IActionResult> Blob() { var scopes = new string[] { "https://storage.azure.com/user_impersonation" }; // I guess the Blob SDK knows already? ViewData["Message"] = await CreateBlob(new TokenAcquisitionTokenCredential(_tokenAcquisition),); return View(); } private static async Task<string> CreateBlob(TokenAcquisitionTokenCredential tokenCredential) { // Replace the URL below with the URL to your blob. Uri blobUri = new Uri("https://storagesamples.blob.core.windows.net/sample-container/blob1.txt"); BlobClient blobClient = new BlobClient(blobUri, tokenCredential); // Create a blob on behalf of the user. string blobContents = "Blob created by Azure AD authenticated user."; byte[] byteArray = Encoding.ASCII.GetBytes(blobContents); using (MemoryStream stream = new MemoryStream(byteArray)) { await blobClient.UploadAsync(stream); } return "Blob successfully created"; } ```
- Loading branch information