Gallery › Storage › Azure built-in policies
Public network access should be disabled for file share with Microsoft.FileShares
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Disabling the public endpoint allows you to restrict access to your Microsoft.FileShares resource to requests destined to approved private endpoints or service endpoints on your organization's network. You can disable the public endpoint for a file share with Microsoft.FileShares by setting the FileShare publicNetworkAccess of the resource to Disabled.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONFileShares_IncomingTrafficPolicy_Audit.json · 50 lines
{
"properties": {
"displayName": "Public network access should be disabled for file share with Microsoft.FileShares",
"description": "Disabling the public endpoint allows you to restrict access to your Microsoft.FileShares resource to requests destined to approved private endpoints or service endpoints on your organization's network. You can disable the public endpoint for a file share with Microsoft.FileShares by setting the FileShare publicNetworkAccess of the resource to Disabled.",
"metadata": {
"version": "1.0.0",
"category": "Storage"
},
"version": "1.0.0",
"policyType": "BuiltIn",
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.FileShares/fileShares"
},
{
"field": "Microsoft.FileShares/fileShares/publicNetworkAccess",
"notEquals": "Disabled"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/edfb40e6-36fe-4928-96e9-e921bc7dfc70",
"name": "edfb40e6-36fe-4928-96e9-e921bc7dfc70"
}Bylawedfb40e6-36fe-4928-96e9-e921bc7dfc70.bylaw.ps1 · 28 lines
# Converted from FileShares_IncomingTrafficPolicy_Audit.json by ConvertTo-Bylaw.
Policy 'edfb40e6-36fe-4928-96e9-e921bc7dfc70' {
Properties @{
DisplayName = 'Public network access should be disabled for file share with Microsoft.FileShares'
Description = 'Disabling the public endpoint allows you to restrict access to your Microsoft.FileShares resource to requests destined to approved private endpoints or service endpoints on your organization''s network. You can disable the public endpoint for a file share with Microsoft.FileShares by setting the FileShare publicNetworkAccess of the resource to Disabled.'
Version = '1.0.0'
Category = 'Storage'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.FileShares/fileShares' {
Require 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Storage/FileShares_IncomingTrafficPolicy_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw