Gallery › API Management › Azure built-in policies
API Management should have username and password authentication disabled
Converted Policy Audit Disabled Mode All Version 1.0.1
To better secure developer portal, username and password authentication in API Management should be disabled. Configure user authentication through Azure AD or Azure AD B2C identity providers and disable the default username and password authentication.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONBasicAuth_Audit.json · 49 lines
{
"properties": {
"displayName": "API Management should have username and password authentication disabled",
"policyType": "BuiltIn",
"mode": "All",
"description": "To better secure developer portal, username and password authentication in API Management should be disabled. Configure user authentication through Azure AD or Azure AD B2C identity providers and disable the default username and password authentication.",
"metadata": {
"version": "1.0.1",
"category": "API Management"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of this policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.ApiManagement/service/portalconfigs"
},
{
"field": "Microsoft.ApiManagement/service/portalconfigs/enableBasicAuth",
"notEquals": false
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/ffe25541-3853-4f4e-b71d-064422294b11",
"name": "ffe25541-3853-4f4e-b71d-064422294b11"
}Bylawffe25541-3853-4f4e-b71d-064422294b11.bylaw.ps1 · 28 lines
# Converted from BasicAuth_Audit.json by ConvertTo-Bylaw.
Policy 'ffe25541-3853-4f4e-b71d-064422294b11' {
Properties @{
DisplayName = 'API Management should have username and password authentication disabled'
Description = 'To better secure developer portal, username and password authentication in API Management should be disabled. Configure user authentication through Azure AD or Azure AD B2C identity providers and disable the default username and password authentication.'
Version = '1.0.1'
Category = 'API Management'
PolicyVersion = '1.0.1'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of this policy'
}
Resource 'Microsoft.ApiManagement/service/portalconfigs' {
Require 'enableBasicAuth is false' {
Field enableBasicAuth | Must -Be $false
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/API Management/BasicAuth_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw