azure policy disable storage account public access

Disable Public Storage Access | Azure Policy | Step-by-Step Guide

By Joseph Lewis
AD

Securing your Azure resources is paramount in today's data-driven landscape. One common misconfiguration that can lead to data exposure is enabling public access for storage accounts. Fortunately, Azure Policy provides a remediation to disable storage account public access.

In this article, we'll guide you through understanding Azure storage account public access and walk you through disabling it using Azure Policy. By the end, you'll have a secure Azure environment that only authorized users can access.

Understanding Azure Storage Account Public Access

By default, when you create an Azure storage account, it is public and can be accessed anonymously. This can pose a security risk, as anyone with the account's URL can access its data. Thus, it's crucial to understand and manage who can access your storage data.

AD
How to Access Azure Storage Account File Shares from .NET Applications | CodeGuru
How to Access Azure Storage Account File Shares from .NET Applications | CodeGuru
How To Add A Storage Account In An Azure Resource Group (Default Approach) - Part One
How To Add A Storage Account In An Azure Resource Group (Default Approach) - Part One
How to Access Azure Storage Account File Shares from .NET Applications | CodeGuru
How to Access Azure Storage Account File Shares from .NET Applications | CodeGuru

Azure provides two levels of access for storage accounts: public access and private access. Private access is the more secure option, allowing you to control who accesses your data.

Identifying Publicly Accessible Storage Accounts

Before remediating, identify publicly accessible storage accounts in your Azure subscriptions. You can use the Azure portal, Azure CLI, or Azure PowerShell for this task. Here's how to do it using the Azure portal:

Azure Storage Role Based Access Control : Revoking Delete Access using RoleDefinition via Powershell | Microsoft Community Hub
Azure Storage Role Based Access Control : Revoking Delete Access using RoleDefinition via Powershell | Microsoft Community Hub
Deploying a Storage Account in Azure using Asure Portal
Deploying a Storage Account in Azure using Asure Portal
How to Access Azure Storage Account File Shares from .NET Applications | CodeGuru
How to Access Azure Storage Account File Shares from .NET Applications | CodeGuru
  1. Sign in to the Azure portal (https://portal.azure.com/).
  2. Navigate to your storage accounts.
  3. Check the "Public access level" under the "Security + networking" section. If it's set to "Public," the storage account is accessible to everyone.

Azure Policy: Disabling Storage Account Public Access

Azure Policy allows you to enforce specific policies across your Azure resources. With just a few clicks, you can ensure all new and existing storage accounts are private and not accessible via anonymous users.

Here's a step-by-step guide to disabling storage account public access using Azure Policy:

AD

Implementing Azure Policy to Control Public Access

Implementing Azure Policy to control public access is a straightforward process. You'll need to create a policy initiative with two policies that work together to enforce private access.

🖥️ How to Create an Azure Storage Account
🖥️ How to Create an Azure Storage Account
Microsoft updates Azure AD with support for temporary passcodes
Microsoft updates Azure AD with support for temporary passcodes
Everything You Need to Know About Blob Storage in Azure
Everything You Need to Know About Blob Storage in Azure
How to Create an Azure Storage Account | CodeGuru
How to Create an Azure Storage Account | CodeGuru
Azure Key Vault Creation, RBAC Setup, User Addition, Secret Management
Azure Key Vault Creation, RBAC Setup, User Addition, Secret Management
How to Create an Azure Storage Account | CodeGuru
How to Create an Azure Storage Account | CodeGuru

Before proceeding, ensure you have the required permissions to create and manage Azure Policy initiatives and assignments.

Creating the Azure Policy Initiative

An initiative groups related policies under a single management entity. Here's how to create a policy initiative to manage Azure storage account public access:

AD
  1. In the Azure portal, navigate to "Policy" under the "Government" section.
  2. Click on "Initiatives" and select "Create initiative."
  3. Enter a name for your initiative (e.g., "StorageAccountAccessPolicy") and a description.
  4. Click "Next: Permissions" and select the scope for your initiative (subscription or resource group).
  5. Click "Next: Policy rules" and add two policy rules—one for new storage accounts and another for existing ones.

Adding Policies to the Initiative

Now, let's add the two policies to the initiative. These policies will ensure all storage accounts (new and existing) are not publicly accessible.

Azure DevOps: Integrate Key Vault Secrets with Local Self-Hosted Agent
Azure DevOps: Integrate Key Vault Secrets with Local Self-Hosted Agent
Backup your Azure Storage using snapshots and Data Factory | Towards Data Science
Backup your Azure Storage using snapshots and Data Factory | Towards Data Science
How to secure Azure Functions with Azure AD, Key Vault and VNETs | Towards Data Science
How to secure Azure Functions with Azure AD, Key Vault and VNETs | Towards Data Science
How to Create an Azure Storage Account | CodeGuru
How to Create an Azure Storage Account | CodeGuru
Exploratory Data Analysis with Azure Synapse Analytics | Towards Data Science
Exploratory Data Analysis with Azure Synapse Analytics | Towards Data Science
AUP , An acceptable use policy is a document stipulating constraints and practices that a user must
AUP , An acceptable use policy is a document stipulating constraints and practices that a user must
How to Create an Azure Storage Account | CodeGuru
How to Create an Azure Storage Account | CodeGuru
How to Create an Azure Storage Account | CodeGuru
How to Create an Azure Storage Account | CodeGuru
Hands-On Azure for Developers
Hands-On Azure for Developers
What is Azure role-based access control (Azure RBAC)?
What is Azure role-based access control (Azure RBAC)?
Building Snowpipe on Azure Blob Storage Using Azure Portal Web UI for Snowflake Data Warehouse | Towards Data Science
Building Snowpipe on Azure Blob Storage Using Azure Portal Web UI for Snowflake Data Warehouse | Towards Data Science
Latest 2025 2026 Edition Az 104 Microsoft Azure Administrator Exam Prep Guide Your Key To Passing On
Latest 2025 2026 Edition Az 104 Microsoft Azure Administrator Exam Prep Guide Your Key To Passing On
How to set up password policies in Azure AD Password Protection
How to set up password policies in Azure AD Password Protection
Automate Azure Key Vault Key Refresh with Managed Identity
Automate Azure Key Vault Key Refresh with Managed Identity
  1. Click on "Assign Policies" for the first policy rule.
  2. Enter the following JSON for the "policyDefinitionId":
  3. "[a Chestney et al.](https://docs.microsoft.com/en-us/azure/governance/policy/samples/azure-policy-storage-account-access)"
  4. Repeat the above steps for the second policy rule. You can reuse the JSON snippet provided.
  5. Click "Next: Review + Create" and then "Create."

Assigned the Initiative to Subscriptions

The final step is to assign the initiative to your subscriptions. Here's how:

  1. In the Azure portal, navigate to your initiative.
  2. Copy the initiative ID (e.g., /subscriptions/[subscriptionID]/resourceGroups/[resourceGroupName]/providers/Microsoft.Resources/policySets/myPolicySetinitiatives/StorageAccountAccessPolicy).
  3. Navigate to your subscriptions and click on "Options" > "Assign Policy."
  4. Paste the initiative ID and click "Save."

You've now successfully implemented Azure Policy to disable storage account public access. In a matter of time, all new and existing storage accounts will be private, ensuring your data remains secure. Stay vigilant and regularly review your policy assignments to keep your Azure environment secure.

AD
AD