Please use this policy definition, this should work.
{
"properties": {
"displayName": "Deny Storage Accounts without private access",
"policyType": "Custom",
"mode": "All",
"description": "Deny creation of storage accounts if public network access is not disabled (i.e., only private endpoint access is allowed).",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"parameters": {},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
},
{
"field": "Microsoft.Storage/storageAccounts/publicNetworkAccess",
"notequals": "Disabled"
}
]
},
"then": {
"effect": "deny"
}
}
}
}
Artifact:
Hope this helps!
let us know if any help, we will always help as you needed.!
Please do not forget to "Accept the answer” and upvote it wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.