Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] BlobServiceClient.GetAccountInfo fails when using DefaultAzureCredential #30761

Closed
cataggar opened this issue Aug 27, 2022 · 3 comments
Closed
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)

Comments

@cataggar
Copy link
Member

cataggar commented Aug 27, 2022

Library name and version

Azure.Storage.Blobs 12.13.1

Describe the bug

BlobServiceClient.GetAccountInfo works when using a connection string, but fails when using DefaultAzureCredential.

Expected behavior

The account info is returned.

Actual behavior

Service responds with a HTTP 404 and an exception is thrown.

Reproduction Steps

Program.cs

using Azure.Identity;
using Azure.Storage.Blobs;

// GetAccountInfo works using a connection string.
{
    var storageConnectionString = Environment.GetEnvironmentVariable("STORAGE_CONNECTION_STRING");
    var serviceClient = new BlobServiceClient(storageConnectionString);
    var accountInfo = serviceClient.GetAccountInfo();
    Console.WriteLine(accountInfo.Value.SkuName);
}

// GetBlobContainers works using DefaultAzureCredential.
{
    var storageAccountName = Environment.GetEnvironmentVariable("STORAGE_ACCOUNT_NAME");
    var accountUri = new Uri($"https://{storageAccountName}.blob.core.windows.net/");
    var serviceClient = new BlobServiceClient(accountUri, new DefaultAzureCredential());
    foreach (var container in serviceClient.GetBlobContainers())
    {
        Console.WriteLine(container.Name);
    }
}

// GetAccountInfo fails with an HTTP 404 Not Found using DefaultAzureCredential.
{
    var storageAccountName = Environment.GetEnvironmentVariable("STORAGE_ACCOUNT_NAME");
    var accountUri = new Uri($"https://{storageAccountName}.blob.core.windows.net/");
    var serviceClient = new BlobServiceClient(accountUri, new DefaultAzureCredential());
    var accountInfo = serviceClient.GetAccountInfo();
    Console.WriteLine(accountInfo.Value.SkuName);
}

csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Azure.Identity" Version="1.6.1" />
    <PackageReference Include="Azure.Storage.Blobs" Version="12.13.1" />
  </ItemGroup>

</Project>

Environment

.NET SDK (reflecting any global.json):
Version: 6.0.400
Commit: 7771abd614

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.400\


Microsoft Visual Studio Enterprise 2022 (64-bit) - Current
Version 17.3.0

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 27, 2022
@azure-sdk azure-sdk added Client This issue points to a problem in the data-plane of the library. needs-team-triage Workflow: This issue needs the team to triage. Storage Storage Service (Queues, Blobs, Files) labels Aug 27, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 27, 2022
@jsquire jsquire added customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team CXP Attention and removed needs-team-triage Workflow: This issue needs the team to triage. labels Aug 28, 2022
@ghost
Copy link

ghost commented Aug 28, 2022

Thank you for your feedback. This has been routed to the support team for assistance.

@PramodValavala-MSFT PramodValavala-MSFT self-assigned this Aug 29, 2022
@PramodValavala-MSFT
Copy link
Contributor

PramodValavala-MSFT commented Aug 29, 2022

@cataggar According to this permission table for data operations, looks like Get Account Information isn't supported.

The same is called out in the REST API reference for the underlying request being made.

You should be able to get the same data using the Management SDK instead, i.e., the GetProperties or GetPropertiesAsync methods.

@PramodValavala-MSFT PramodValavala-MSFT added needs-author-feedback Workflow: More information is needed from author to address the issue. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Aug 29, 2022
@cataggar
Copy link
Member Author

Thanks @PramodValavala-MSFT. The see it is not supposed to work.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

4 participants