Resolving "Public access is not permitted on this storage account" error in Azure Blob Storage

Abdul 2,615 Reputation points Microsoft Vendor
2024-07-31T10:41:30.08+00:00

How can I fix the "Public access is not permitted on this storage account" error when creating a container in Azure Blob Storage using Terraform?

 "PS - Based on common issues that we have seen from customers and other sources, we are posting these questions to help the Azure community."

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,920 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Abdul 2,615 Reputation points Microsoft Vendor
    2024-07-31T10:44:40.2733333+00:00

    Greetings!

    The error "Public access is not permitted on this storage account" indicates that your storage account settings do not allow any form of public (anonymous) access. In this particular scenario, the error was encountered while trying to create a container with public access, but the storage account was configured to only allow private access.

    To address this issue, you need to change the container access type to private, aligning with the storage account's policy that disallows public access.

    Steps to resolve:

    1. Modify Container Access Type:
      • Adjust your Terraform configuration or update it through the Azure portal to set the container access type to private.
    2. Check Storage Account Settings:
      • Confirm that the "Allow Blob Public Access" setting for your storage account is set to false if you want to enforce private access on all containers.

    Example Terraform script for setting container access type to private:

    
    resource "azurerm_storage_container" "example" {
    
      name                  = "your-container-name"
    
      storage_account_name  = azurerm_storage_account.example.name
    
      container_access_type = "private"
    
    }
    
    

    For more details, consult the following resources:

    #Resources

    Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.

    Please do not forget to "up-vote" wherever the information provided helps you, as this can be beneficial to other community members.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.