Azure blob services - AuthorizationFailed - /Microsoft.Storage/storageAccounts/<ACCOUNT_NAME>/blobServices/default - JAVA sdk

2022-09-13T08:10:33.547+00:00

I am trying to obtain the "Versioning" status of my Storage account using azure-sdk-for-java

// Azure environment URL is ".core.windows.net" hence used "AzureEnvironment.AZURE"

// this.clientSecretCredential ->is built using AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID

    AzureProfile profile = new AzureProfile("<TENANT_ID", "<SUBSCRIPTION_ID>", AzureEnvironment.AZURE);  

    StorageManager manager = StorageManager.authenticate(this.clientSecretCredential, profile);  

    BlobServicesClient blobServicesClient = manager.serviceClient().getBlobServices();  

// Exception is thrown at the following line

    BlobServicePropertiesInner blobServicePropertiesInner = blobServicesClient.getServiceProperties("<RESOURCE_GROUP_NAME>", "<ACCOUNT_NAME>");  

    boolean versionFlag = blobServicePropertiesInner.isVersioningEnabled();  

Azure configuration details:

  1. Subscrition: "<SUBSCRIPTION_ID>" is created in the subscriptions.
  2. Resource Group: "<RESOURCE_GROUP_NAME>" is configured with the "<SUBSCRIPTION_ID>".
  3. Storage Accouunt: "<ACCOUNT_NAME>" is configured with the "<SUBSCRIPTION_ID>".
  4. App Registartion: "<APP_REGISTARTION>" is created to provide the "<AZURE_CLIENT_ID>", "<AZURE_CLIENT_SECRET>", "<AZURE_TENANT_ID>"
  5. Role Assignments: "DEVELOPER" has "Reader" access across subscriptions, resource groups, storage accounts but still I still have no idea on how the App registration is configured into the subscription

Error Message:

{
"code": "ERROR",
"message": "Status code 403, \"{\"error\":{\"code\":\"AuthorizationFailed\",\"message\":\"The client '<APP_REGISTARTION_OBJECT_ID>' with object id '<APP_REGISTARTION_OBJECT_ID>' does not have authorization to perform action 'Microsoft.Storage/storageAccounts/blobServices/read' over scope '/subscriptions/{"<SUBSCRIPTION_ID>"}/resourceGroups/Titaniam-Sandbox/providers/Microsoft.Storage/storageAccounts/sandboxtestaccount/blobServices/default' or the scope is invalid. If access was recently granted, please refresh your credentials.\"}}\""
}

Kinldy let me know what is the mistake i am making whether it is a code issue or configuration issue.

Things i am need of clarification:

  1. Is there any other way to get the "is Versioning enabled" value using azure-sdk-for-java?
  2. How App registration is connected with subscription.
  3. How are roles connected with App registration as well as subscription.
  4. How to set the scope
  5. How to add the application and how to identify the application.

Thanks in advance.

https://stackoverflow.com/questions/73699489/azure-blob-services-authorizationfailed-microsoft-storage-storageaccounts

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,687 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,473 questions
{count} votes