Gallery › Guest Configuration › Azure built-in policies
[Preview]: Audit Local Administrator Password Solution (LAPS)
Doesn't convert yet Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-preview Preview
This policy audits the configuration of Local Administrator Password Solution (LAPS). For more information, see https://aka.ms/LAPS4ARC.
ConvertTo-Bylaw can't convert this policy yet:
- BYL6003 The converted file doesn't compile, which is a ConvertTo-Bylaw bug: BYL3007: Metadata key 'guestConfiguration' is longer than the 1024 characters Azure allows per metadata property.
Azure Policy JSONLocalAdministratorPasswordSolution_AINE.json · 488 lines
{
"properties": {
"displayName": "[Preview]: Audit Local Administrator Password Solution (LAPS)",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy audits the configuration of Local Administrator Password Solution (LAPS). For more information, see https://aka.ms/LAPS4ARC.",
"metadata": {
"category": "Guest Configuration",
"version": "1.0.0-preview",
"preview": true,
"requiredProviders": [
"Microsoft.GuestConfiguration"
],
"guestConfiguration": {
"name": "LocalAdministratorPasswordSolution",
"version": "1.*",
"configurationParameter": {
"BackupDirectory": "Enforce password backup;Value",
"PasswordComplexity": "Enforce password complexity;Value",
"PasswordLength": "Enforce minimum password length;Value",
"PassphraseLength": "Enforce minimum passphrase length;Value",
"PasswordAgeDays": "Enforce password age in days;Value",
"PostAuthenticationActions": "Enforce post-authentication actions;Value",
"PostAuthenticationResetDelay": "Enforce post-authentication reset delay;Value",
"AdministratorAccountName": "Enforce administrator account name;Value",
"ADPasswordEncryptionEnabled": "Enforce password encryption;Value",
"ADPasswordEncryptionPrincipal": "Enforce authorized password decryptors;Value",
"ADEncryptedPasswordHistorySize": "Enforce encrypted password history size;Value",
"PasswordExpirationProtectionEnabled": "Enforce password expiration protection;Value",
"AutomaticAccountManagementEnabled": "Enforce automatic account management;Value",
"AutomaticAccountManagementTarget": "Enforce automatic account management target;Value",
"AutomaticAccountManagementNameOrPrefix": "Enforce automatic account name or prefix;Value",
"AutomaticAccountManagementRandomizeName": "Enforce automatic account name randomization;Value",
"AutomaticAccountManagementEnableAccount": "Enforce automatic account enablement;Value"
}
}
},
"version": "1.0.0-preview",
"parameters": {
"IncludeArcMachines": {
"type": "string",
"metadata": {
"displayName": "Include Arc connected machines",
"description": "By selecting this option, you agree to be charged monthly per Arc connected machine.",
"portalReview": "true"
},
"allowedValues": [
"true",
"false"
],
"defaultValue": "false"
},
"effect": {
"type": "string",
"metadata": {
"displayName": "Effect",
"description": "Set the effect for this policy. AuditIfNotExists will audit machines. Disabled will disable the policy."
},
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"defaultValue": "AuditIfNotExists"
},
"BackupDirectory": {
"type": "string",
"metadata": {
"displayName": "Password backup directory",
"description": "Configure which directory the local admin account password is backed up to. 0 = Disabled, 1 = Azure Active Directory, 2 = Active Directory."
},
"allowedValues": [
"0",
"1",
"2"
],
"defaultValue": "1"
},
"PasswordComplexity": {
"type": "string",
"metadata": {
"displayName": "Password complexity",
"description": "Configure the complexity of the generated password. 1 = Large letters, 2 = Large letters and small letters, 3 = Large letters, small letters, and numbers, 4 = Large letters, small letters, numbers, and special characters."
},
"allowedValues": [
"1",
"2",
"3",
"4"
],
"defaultValue": "4"
},
"PasswordLength": {
"type": "string",
"metadata": {
"displayName": "Password length",
"description": "Configure the length of the generated password. Minimum is 8, maximum is 64."
},
"defaultValue": "15"
},
"PassphraseLength": {
"type": "string",
"metadata": {
"displayName": "Passphrase length",
"description": "Configure the number of words in the generated passphrase. Minimum is 3, maximum is 10."
},
"defaultValue": "6"
},
"PasswordAgeDays": {
"type": "string",
"metadata": {
"displayName": "Password age (days)",
"description": "Configure the maximum password age in days. The password will be rotated after this number of days."
},
"defaultValue": "30"
},
"PostAuthenticationActions": {
"type": "string",
"metadata": {
"displayName": "Post-authentication actions",
"description": "Configure the actions to take after authenticating with the managed account. 0 = None, 1 = Reset password, 3 = Reset password and logoff, 5 = Reset password and reboot."
},
"allowedValues": [
"0",
"1",
"3",
"5"
],
"defaultValue": "3"
},
"PostAuthenticationResetDelay": {
"type": "string",
"metadata": {
"displayName": "Post-authentication reset delay (hours)",
"description": "Configure the delay in hours before the post-authentication actions are executed."
},
"defaultValue": "24"
},
"AdministratorAccountName": {
"type": "string",
"metadata": {
"displayName": "Administrator account name",
"description": "Configure the name of the local administrator account to manage. Leave empty to manage the built-in administrator account."
},
"defaultValue": ""
},
"ADPasswordEncryptionEnabled": {
"type": "string",
"metadata": {
"displayName": "Password encryption enabled",
"description": "Configure whether the password is encrypted before being stored in Active Directory. 0 = Disabled, 1 = Enabled."
},
"allowedValues": [
"0",
"1"
],
"defaultValue": "1"
},
"ADPasswordEncryptionPrincipal": {
"type": "string",
"metadata": {
"displayName": "Authorized password decryptors",
"description": "Configure the user or group that is authorized to decrypt the password from Active Directory."
},
"defaultValue": ""
},
"ADEncryptedPasswordHistorySize": {
"type": "string",
"metadata": {
"displayName": "Encrypted password history size",
"description": "Configure how many previous encrypted passwords are stored in Active Directory. 0 = Disabled."
},
"defaultValue": "0"
},
"PasswordExpirationProtectionEnabled": {
"type": "string",
"metadata": {
"displayName": "Password expiration protection",
"description": "Configure whether password expiration protection is enabled. 0 = Disabled, 1 = Enabled."
},
"allowedValues": [
"0",
"1"
],
"defaultValue": "1"
},
"AutomaticAccountManagementEnabled": {
"type": "string",
"metadata": {
"displayName": "Automatic account management",
"description": "Configure whether automatic account management is enabled. 0 = Disabled, 1 = Enabled."
},
"allowedValues": [
"0",
"1"
],
"defaultValue": "0"
},
"AutomaticAccountManagementTarget": {
"type": "string",
"metadata": {
"displayName": "Automatic account management target",
"description": "Configure the target for automatic account management. 0 = Built-in administrator account, 1 = New local admin account."
},
"allowedValues": [
"0",
"1"
],
"defaultValue": "1"
},
"AutomaticAccountManagementNameOrPrefix": {
"type": "string",
"metadata": {
"displayName": "Automatic account name or prefix",
"description": "Configure the name or prefix for the automatically managed account."
},
"defaultValue": "WLapsAdmin"
},
"AutomaticAccountManagementRandomizeName": {
"type": "string",
"metadata": {
"displayName": "Randomize automatic account name",
"description": "Configure whether the name of the managed account uses a random numeric suffix. 0 = Disabled, 1 = Enabled."
},
"allowedValues": [
"0",
"1"
],
"defaultValue": "0"
},
"AutomaticAccountManagementEnableAccount": {
"type": "string",
"metadata": {
"displayName": "Enable automatic account",
"description": "Configure whether to enable the automatically managed account. 0 = Disabled, 1 = Enabled."
},
"allowedValues": [
"0",
"1"
],
"defaultValue": "0"
}
},
"policyRule": {
"if": {
"anyOf": [
{
"allOf": [
{
"field": "type",
"in": [
"Microsoft.Compute/virtualMachines",
"Microsoft.Compute/virtualMachineScaleSets"
]
},
{
"field": "tags['aks-managed-orchestrator']",
"exists": false
},
{
"field": "tags['aks-managed-poolName']",
"exists": false
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"in": [
"esri",
"incredibuild",
"MicrosoftDynamicsAX",
"MicrosoftSharepoint",
"MicrosoftVisualStudio",
"MicrosoftWindowsDesktop",
"MicrosoftWindowsServerHPCPack"
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "MicrosoftWindowsServer"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2008*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "MicrosoftSQLServer"
},
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "SQL2008*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-dsvm"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "dsvm-win*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "microsoft-ads"
},
{
"field": "Microsoft.Compute/imageOffer",
"in": [
"standard-data-science-vm",
"windows-data-science-vm"
]
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "batch"
},
{
"field": "Microsoft.Compute/imageOffer",
"equals": "rendering-windows2016"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "center-for-internet-security-inc"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "cis-windows-server-201*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "pivotal"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "bosh-windows-server*"
}
]
},
{
"allOf": [
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "cloud-infrastructure-services"
},
{
"field": "Microsoft.Compute/imageOffer",
"like": "ad*"
}
]
},
{
"allOf": [
{
"anyOf": [
{
"field": "Microsoft.Compute/virtualMachines/osProfile.windowsConfiguration",
"exists": true
},
{
"field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
"like": "Windows*"
},
{
"field": "Microsoft.Compute/VirtualMachineScaleSets/osProfile.windowsConfiguration",
"exists": true
},
{
"field": "Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.storageProfile.osDisk.osType",
"like": "Windows*"
}
]
},
{
"anyOf": [
{
"field": "Microsoft.Compute/imageSKU",
"exists": false
},
{
"allOf": [
{
"field": "Microsoft.Compute/imageOffer",
"notLike": "SQL2008*"
},
{
"field": "Microsoft.Compute/imageSKU",
"notLike": "2008*"
}
]
}
]
}
]
}
]
}
]
},
{
"allOf": [
{
"value": "[parameters('IncludeArcMachines')]",
"equals": "true"
},
{
"anyOf": [
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.HybridCompute/machines"
},
{
"field": "Microsoft.HybridCompute/imageOffer",
"like": "windows*"
}
]
},
{
"allOf": [
{
"field": "type",
"equals": "Microsoft.ConnectedVMwarevSphere/virtualMachines"
},
{
"field": "Microsoft.ConnectedVMwarevSphere/virtualMachines/osProfile.osType",
"like": "windows*"
}
]
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
"name": "LocalAdministratorPasswordSolution",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
"equals": "Compliant"
},
{
"field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/parameterHash",
"equals": "[base64(concat('Enforce password backup;Value', '=', parameters('BackupDirectory'), ',', 'Enforce password complexity;Value', '=', parameters('PasswordComplexity'), ',', 'Enforce minimum password length;Value', '=', parameters('PasswordLength'), ',', 'Enforce minimum passphrase length;Value', '=', parameters('PassphraseLength'), ',', 'Enforce password age in days;Value', '=', parameters('PasswordAgeDays'), ',', 'Enforce post-authentication actions;Value', '=', parameters('PostAuthenticationActions'), ',', 'Enforce post-authentication reset delay;Value', '=', parameters('PostAuthenticationResetDelay'), ',', 'Enforce administrator account name;Value', '=', parameters('AdministratorAccountName'), ',', 'Enforce password encryption;Value', '=', parameters('ADPasswordEncryptionEnabled'), ',', 'Enforce authorized password decryptors;Value', '=', parameters('ADPasswordEncryptionPrincipal'), ',', 'Enforce encrypted password history size;Value', '=', parameters('ADEncryptedPasswordHistorySize'), ',', 'Enforce password expiration protection;Value', '=', parameters('PasswordExpirationProtectionEnabled'), ',', 'Enforce automatic account management;Value', '=', parameters('AutomaticAccountManagementEnabled'), ',', 'Enforce automatic account management target;Value', '=', parameters('AutomaticAccountManagementTarget'), ',', 'Enforce automatic account name or prefix;Value', '=', parameters('AutomaticAccountManagementNameOrPrefix'), ',', 'Enforce automatic account name randomization;Value', '=', parameters('AutomaticAccountManagementRandomizeName'), ',', 'Enforce automatic account enablement;Value', '=', parameters('AutomaticAccountManagementEnableAccount')))]"
}
]
}
}
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/1c641ad7-3397-4594-b82a-ddc627e14582",
"name": "1c641ad7-3397-4594-b82a-ddc627e14582"
}Source: built-in-policies/policyDefinitions/Guest Configuration/LocalAdministratorPasswordSolution_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw