0
votes

I am trying to to create a folder inside a blob storage container in Azure using terraform but it is failing as below. Any work around to achieve this ? Create a empty folder or a folder inside a blob storage container with a dummy file just to achieve the folder creation.

provider "azurerm" {
  features {}
  version  = ">=1.31"
  }
  
  resource "azurerm_storage_blob" "test" {
  name                   = "test/1.txt              "
  storage_account_name   = azurerm_storage_account.azstg-rg.name
  storage_container_name = azurerm_storage_container.stor-cont.name
  type                   = "Block"
  source                 = "./1.txt"

}

The script executes successfully however I am not able to view the folder and dont think it was successful.

Error Message

1
You can add permission to view the content of the blob ( In case you are the owner), click on Access control (IAM) -> Add -> Fill the relevant data -> Click saveAmit Baranes
The logged in user is having contributor access to the subscription already. Looks like it is creating a corrupted folder.venkatesh sivalingam
I can reproduce this error. Does it solve your question?Nancy Xiong
No.The error is still there. Looks like the folder is not getting created properlyvenkatesh sivalingam

1 Answers

0
votes

From this, please note that,

When you access blob or queue data using the Azure portal, the portal makes requests to Azure Storage under the covers. A request to Azure Storage can be authorized using either your Azure AD account or the storage account access key. The portal indicates which method you are using, and enables you to switch between the two if you have the appropriate permissions.

In this case, you can check the current authentication method when you view the folder. If you are authenticating using your Azure AD account, you need to grant RBAC roles for blobs to the logged in user. In addition, ensure that you does not have set any network_rules in the storage account level to restrict this request.

Edit

I can reproduce this error with the following code. By default, you will access the blobs with storage account access key authentication when your logged in user is having contributor role access to the subscription already.

You can select the change access level to container(anonymous read access for containers and blobs) via clicking ... at right side of your container name. Then refresh your web browser and re-check your data blob. Then you can change change access level back to private. If you can not do this in the UI, try to change the authentication method to using Azure AD account, after finished the above then change it back to using access key.

enter image description here