An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
Hello Srinath, you can absolutely lock down storage account creation so that it’s denied unless a Private Endpoint is also deployed. The easiest way is to leverage Azure Policy. Below is a sample “deny” policy definition that checks for the existence of at least one private endpoint connection on a storage account and blocks the creation if none is found.
— Sample Azure Policy Definition —
{
"properties": {
"displayName": "Deny storage account without Private Endpoint",
"policyType": "Custom",
"mode": "Indexed",
"description": "This policy denies creation of Storage Accounts unless they have an associated Private Endpoint connection.",
"parameters": {},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"count": {
"field": "Microsoft.Storage/storageAccounts/privateEndpointConnections[*]",
"where": {
"field": "Microsoft.Storage/storageAccounts/privateEndpointConnections[*].privateEndpoint.id",
"notEquals": ""
}
},
"equals": 0
}
]
},
"then": {
"effect": "deny"
}
}
}
}
Steps to use it:
- Go to Azure Portal → Policy → “Definitions” → “+ Policy definition”.
- Paste the JSON above.
- Save, then Assign it to the desired scope (subscription or resource group) so that any new storage account creation will be blocked unless a Private Endpoint is declared in that same template or request.
If you’d rather have Azure automatically inject or deploy the Private Endpoint when someone creates the storage account, you can swap out "effect": "deny" for a "deployIfNotExists" effect—using an ARM template in the policy’s deployment block to spin up the Private Endpoint in a specified VNet/Subnet.
Reference list these docs dive into private endpoint setup, troubleshooting, and Azure Policy:
- Create Storage Private Endpoints https://docs.microsoft.com/azure/private-link/create-private-endpoint-storage-portal
- Azure Policy overview https://learn.microsoft.com/azure/governance/policy/overview
- Troubleshoot Private Endpoint creation issues https://docs.microsoft.com/azure/private-link/private-endpoint-overview
- DNS changes for Private Endpoints https://docs.microsoft.com/azure/storage/common/storage-private-endpoints#dns-changes-for-private-endpoints
Hope this helps. If the information was useful, please consider accepting the answer and upvoting. Feel free to reach out if you need any further assistance. Thank you.