Unable to install built-in guest configurations in Azure Windows VM

Seelam, Bharath 0 Reputation points
2026-05-20T12:51:30.81+00:00

I am using bicep to install some built-in guest configurations in my windows machine. But they are in pending state as in the below screenshot. I suspect I am missing source(ContentUri) in the bicep for those guest configuration assignments. Can anyone help me what should be contentUri here for built-in guest configurations ?

The bicep is as below:


param location string

param vm_configuration object
param vnet_externalid string
param minimumPasswordLength string = '14'   
param enforcePasswordHistory string = '24'  
param maximumPasswordAge string = '70'      

module nic 'networkInterfaces/hubutil-nic.bicep' = {
  name: 'nic_deployment'
  params: {
    location: location
    nic_name: vm_configuration.nic_name
    vnet_externalid: vnet_externalid
  }
}

module osDisk 'osDisks/hubutil-disk.bicep' = {
  name: 'OSDisk_deployment'
  params: {
    location: location
    osDisk_name: vm_configuration.osDisk.name
  }
}

resource datadog_uami 'Microsoft.ManagedIdentity/userAssignedIdentities@2025-01-31-preview' = {
  name: vm_configuration.datadog_uami_name
  location: location
}

resource virtualMachine_hubutil 'Microsoft.Compute/virtualMachines@2024-11-01' = {
  name: vm_configuration.vmName
  location: location
  tags: {
    'managed-by': 'bicep'
  }
  identity: {
    type: 'SystemAssigned, UserAssigned' // SystemAssigned is required for Guest Configuration
    userAssignedIdentities: {
      '${datadog_uami.id}': {}
    }
  }
  properties: {
    hardwareProfile: {
      vmSize: vm_configuration.vmSize
    }
    additionalCapabilities: {
      hibernationEnabled: false
    }
    storageProfile: {
      imageReference: {
        publisher: 'MicrosoftWindowsServer'
        offer: 'WindowsServer'
        sku: '2022-datacenter-azure-edition-hotpatch'
        version: 'latest'
      }
      osDisk: {
        osType: 'Windows'
        name: vm_configuration.osDisk.name
        createOption: 'FromImage'
        caching: 'ReadWrite'
        managedDisk: {
          storageAccountType: 'Premium_LRS'
          id: osDisk.outputs.osDisk_id
        }
        deleteOption: 'Delete'
        diskSizeGB: 127
      }
      dataDisks: []
      diskControllerType: 'SCSI'
    }
    osProfile: {
      computerName: vm_configuration.vmName
      adminUsername: vm_configuration.adminUsername
      windowsConfiguration: {
        provisionVMAgent: true
        enableAutomaticUpdates: true
        patchSettings: {
          patchMode: 'AutomaticByPlatform'
          automaticByPlatformSettings: {
            rebootSetting: 'IfRequired'
          }
          assessmentMode: 'ImageDefault'
          enableHotpatching: true
        }
      }
      secrets: []
      allowExtensionOperations: true
      requireGuestProvisionSignal: true
    }
    securityProfile: {
      uefiSettings: {
        secureBootEnabled: true
        vTpmEnabled: true
      }
      securityType: 'TrustedLaunch'
    }
    networkProfile: {
      networkInterfaces: [
        {
          id: nic.outputs.nic_id
          properties: {
            deleteOption: 'Delete'
          }
        }
      ]
    }
    diagnosticsProfile: {
      bootDiagnostics: {
        enabled: true
      }
    }
  }
}

// --------------------------------------------------------
// Guest Configuration Extension
// One extension serves all assignments below
// --------------------------------------------------------
resource guestConfigExtension 'Microsoft.Compute/virtualMachines/extensions@2024-11-01' = {
  parent: virtualMachine_hubutil
  name: 'AzurePolicyforWindows'
  location: location
  properties: {
    publisher: 'Microsoft.GuestConfiguration'
    type: 'ConfigurationforWindows'
    typeHandlerVersion: '1.1'
    autoUpgradeMinorVersion: true
    enableAutomaticUpgrade: true
    settings: {}
    protectedSettings: {}
  }
}

// --------------------------------------------------------
// Assignment 1: Minimum Password Length
// Policy ID: a2d0e922-65d0-40c4-8f87-ea6da2d307a2
// Default: 14 characters
// --------------------------------------------------------
resource guestConfig_minPasswordLength 'Microsoft.GuestConfiguration/guestConfigurationAssignments@2020-06-25' = {
  name: 'MinimumPasswordLength'
  scope: virtualMachine_hubutil
  location: location
  dependsOn: [
    guestConfigExtension
  ]
  properties: {
    guestConfiguration: {
      name: 'MinimumPasswordLength'
      version: '1.*'
      assignmentType: 'ApplyAndAutoCorrect' // Auto-fixes if password policy drifts
      configurationParameter: [
        {
          name: '[AccountPolicy]MinimumPasswordLength;Minimum_Password_Length'
          value: minimumPasswordLength
        }
      ]
    }
  }
}

// --------------------------------------------------------
// Assignment 2: Password History
// Policy ID: 5b054a0d-39e2-4d53-bea3-9734cad2c69b
// Default: 24 unique passwords before reuse
// --------------------------------------------------------
resource guestConfig_passwordHistory 'Microsoft.GuestConfiguration/guestConfigurationAssignments@2020-06-25' = {
  name: 'EnforcePasswordHistory'
  scope: virtualMachine_hubutil
  location: location
  dependsOn: [
    guestConfigExtension
  ]
  properties: {
    guestConfiguration: {
      name: 'EnforcePasswordHistory'
      version: '1.*'
      assignmentType: 'ApplyAndAutoCorrect' // Auto-fixes if password policy drifts
      configurationParameter: [
        {
          name: '[AccountPolicy]EnforcePasswordHistory;Enforce_password_history'
          value: enforcePasswordHistory
        }
      ]
    }
  }
}

// --------------------------------------------------------
// Assignment 3: Maximum Password Age
// Policy ID: 4ceb8dc2-559c-478b-a15b-733fbf1e3738
// Default: 70 days before password must be changed
// --------------------------------------------------------
resource guestConfig_maximumPasswordAge 'Microsoft.GuestConfiguration/guestConfigurationAssignments@2020-06-25' = {
  name: 'MaximumPasswordAge'
  scope: virtualMachine_hubutil
  location: location
  dependsOn: [
    guestConfigExtension
  ]
  properties: {
    guestConfiguration: {
      name: 'MaximumPasswordAge'
      version: '1.*'
      assignmentType: 'ApplyAndAutoCorrect' // Auto-fixes if password policy drifts
      configurationParameter: [
        {
          name: '[AccountPolicy]MaximumPasswordAge;Maximum_Password_Age'
          value: maximumPasswordAge
        }
      ]
    }
  }
}

User's image

Azure Policy
Azure Policy

An Azure service that is used to implement corporate governance and standards at scale for Azure resources.


1 answer

Sort by: Most helpful
  1. AI answer

    2026-05-20T12:51:56.38+00:00

    For built‑in guest configuration packages such as:

    • MinimumPasswordLength
    • EnforcePasswordHistory
    • MaximumPasswordAge

    no contentUri or contentHash is required in the guestConfigurationAssignments resource. Those properties are only needed when assigning a custom guest configuration package that has been uploaded to storage.

    The built‑in configurations are referenced only by:

    properties: {
      guestConfiguration: {
        name: 'MinimumPasswordLength'   // or EnforcePasswordHistory, MaximumPasswordAge
        version: '1.*'
        assignmentType: 'ApplyAndAutoCorrect'
        configurationParameter: [ ... ]
      }
    }
    

    This matches the schema for Microsoft.GuestConfiguration/guestConfigurationAssignments where contentUri and contentHash are optional fields used to point to a custom package.

    If the assignments remain in Pending state, the cause is not a missing contentUri. Troubleshooting should instead focus on the VM/extension side (for example, ensuring the Guest Configuration extension is healthy and that the VM can reach the guest configuration service), but that information is outside the provided context.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.