azure policy storage account public access

Manage Azure Storage Account Public Access using Policies

By Jessica Brown
AD

Managing access to your Azure storage accounts is a critical aspect of ensuring the security and compliance of your data. Microsoft Azure provides a robust set of tools to control and monitor access, including Azure Policy. Azure Policy helps you to enforce policies across your resources and ensures adherence to organizational standards and regulatory requirements.

With Azure Policy, you can define and apply policies to your storage accounts, controlling public access and ensuring that it complies with your organization's access policies. So, what are the options when it comes to Azure storage account public access?

Understanding Azure Storage Account Public Access Levels

Azure storage accounts offer four levels of public read access:

AD
🖥️ How to Create an Azure Storage Account
🖥️ How to Create an Azure Storage Account
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 work with Azure file storage in C#
How to work with Azure file storage in C#

  • No public access: No anonymous read access to the storage account.
  • Public access: Anonymous read access to all blobs (objects).
  • Opening publicly for designated network: Public read access to blobs, but only for the designated network.
  • Public access only for named network: Anonymous read access to specified blobs and containers.

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 Key Vault Creation, RBAC Setup, User Addition, Secret Management
Azure Key Vault Creation, RBAC Setup, User Addition, Secret Management

Enforcing Public Access Restrictions with Azure Policy

Azure Policy allows you to enforce desired state configurations across your Azure resources, including storage accounts. You can use Azure Policy to ensure that the public access level of your storage accounts does not exceed the allowed level.

Here's how you can use an Azure Policy to ensure that the public access level does not exceed 'Public access only for named network':

AD

Microsoft Addresses Azure AD nOAuth Flaw Allowing Account Takeover
Microsoft Addresses Azure AD nOAuth Flaw Allowing Account Takeover
Configuring Security Center Resource Type Pricing with Azure Policy (contains updated policies) | Microsoft Community Hub
Configuring Security Center Resource Type Pricing with Azure Policy (contains updated policies) | Microsoft Community Hub
Deploying a Storage Account in Azure using Asure Portal
Deploying a Storage Account in Azure using Asure Portal
Azure: Architect a Compliant Cloud for Healthcare Clients
Azure: Architect a Compliant Cloud for Healthcare Clients
What is Azure role-based access control (Azure RBAC)?
What is Azure role-based access control (Azure RBAC)?
Backup your Azure Storage using snapshots and Data Factory | Towards Data Science
Backup your Azure Storage using snapshots and Data Factory | Towards Data Science
  1. Create a new policy definition with the JSON snippet provided by Microsoft, which checks if the publicAccess property of your storage account is not set to 'Public access only for named network'.
  2. Assign the policy to a scope that includes your Azure storage accounts.
  3. Test the policy to ensure that it is enforcing the desired state.

Monitoring Public Access Changes with Azure Policy

In addition to enforcing your desired state, Azure Policy also provides built-in monitoring capabilities. You can use these to track changes to the public access level of your storage accounts.

AD

For example, you can use Azure Policy to initiate an alert when the publicAccess property of a storage account changes to a different level than 'Public access only for named network'. This allows you to detect and respond to unauthorized changes in real-time.

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
Public preview: “What If” tool for Azure AD Conditional Access policies | Microsoft Community Hub
Public preview: “What If” tool for Azure AD Conditional Access policies | Microsoft Community Hub
Everything You Need to Know About Blob Storage in Azure
Everything You Need to Know About Blob Storage in Azure
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
Overview Of Microsoft Azure Storage - Part One
Overview Of Microsoft Azure Storage - Part One
Hands-On Azure for Developers
Hands-On Azure for Developers
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
Azure DevOps: Integrate Key Vault Secrets with Local Self-Hosted Agent
Azure DevOps: Integrate Key Vault Secrets with Local Self-Hosted Agent
Manage Authentication Sessions in Outlook on the web with Azure AD Conditional Access | Microsoft Community Hub
Manage Authentication Sessions in Outlook on the web with Azure AD Conditional Access | Microsoft Community Hub
the azure data factory is connected to an azure server and has several different types of storage
the azure data factory is connected to an azure server and has several different types of storage
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

AzPowerShell and Infrastructure as Code

In addition to using Azure Policy, Azure provides other tools to manage and monitor your storage accounts' public access levels. One of these tools is Azure PowerShell, which provides a command-line interface for managing Azure resources.

PowerShell also includes a cmdlet called 'Set-AzStorageAccount', which allows you to change the public access level of a storage account. However, it's important to note that this can be a state-less operation, meaning that it does not enforce your desired state configuration.

AD

Enforcing Desired State with Infrastructure as Code

The term 'Infrastructure as Code' (IaC) refers to using code to provision and manage infrastructure. IaC tools like Terraform, Azure Resource Manager (ARM), and Bicep allow you to define and enforce your desired state configuration.

For example, with Bicep, you can write a file that specifies the desired state of your storage account, including the publicAccess property. When you deploy this file, the storage account would be created with the specified public access level, and any changes would be reverted to the desired state.

In conclusion, managing public access to your Azure storage accounts is a critical aspect of ensuring the security and compliance of your data. Azure Policy, PowerShell, and IaC tools provide a variety of methods for managing and monitoring access, allowing you to enforce your desired state configuration and respond to unauthorized changes. It is important to review these options and choose the best strategy for your organization's needs.

AD