Can't enable SystemAssigned identity to VMSS with Bicep

Vasiliy Grinko 20 Reputation points
2024-04-16T13:21:33.44+00:00

I'm trying to create a VMSS with Bicep with SystemAssigned identity enabled,

here is my Bicep code:


resource Build_VMSS 'Microsoft.Compute/virtualMachineScaleSets@2023-09-01' = {
  name: 'BUILD-VMSS-test'
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  sku: {
    name: 'Standard_D2s_v3'
    tier: 'Standard'
    capacity: 1
  }
  properties: {
    singlePlacementGroup: false
    upgradePolicy: {
      mode: 'Manual'
    }
    scaleInPolicy: {
      rules: [
        'Default'
      ]
      forceDeletion: false
    }
    virtualMachineProfile: {
      osProfile: {
        computerNamePrefix: 'build-'
        adminPassword: adminPass
        adminUsername: 'azureadmin'
        windowsConfiguration: {
          provisionVMAgent: true
          enableAutomaticUpdates: true
          enableVMAgentPlatformUpdates: false
        }
        allowExtensionOperations: true
      }
      storageProfile: {
        osDisk: {
          osType: 'Windows'
          createOption: 'FromImage'
          caching: 'None'
          managedDisk: {
            storageAccountType: 'StandardSSD_LRS'
          }
          diskSizeGB: 256
        }
        imageReference: {
          id: '/subscriptions/sub-id/resourceGroups/dev-rg/providers/Microsoft.Compute/galleries/VirtualMachine/images/BuildServer/versions/3.1.0'
        }
      }
      networkProfile: {
        networkInterfaceConfigurations: [
          {
            name: 'vNET-nic01'
            properties: {
              primary: true
              enableAcceleratedNetworking: false
              disableTcpStateTracking: false
              enableIPForwarding: false
              ipConfigurations: [
                {
            
                  name: 'vNET-nic01-defaultIpConfiguration'
                  properties: {
                     
                    primary: true
                    subnet: {
                      id: 'removed'
                    }
                    privateIPAddressVersion: 'IPv4'
                  }
                }
              ]
            }
          }
        ]
      }
      diagnosticsProfile: {
        bootDiagnostics: {
          enabled: false
        }
      }
      extensionProfile: {
        extensions: [
          {
            name: 'Microsoft.Azure.DevOps.Pipelines.Agent'
            properties: {
              autoUpgradeMinorVersion: false
              provisionAfterExtensions: [
                'customScript'
              ]
              publisher: 'Microsoft.VisualStudio.Services'
              type: 'TeamServicesAgent'
              typeHandlerVersion: '1.31'
              settings: {
                isPipelinesAgent: true
                agentFolder: 'C:\\agent'
                agentDownloadUrl: 'https://vstsagentpackage.azureedge.net/agent/3.236.1/vsts-agent-win-x64-3.236.1.zip'
                enableScriptDownloadUrl: 'https://vstsagenttools.blob.core.windows.net/tools/ElasticPools/Windows/17/enableagent.ps1'
              }
            }
          }
          {
            name: 'customScript'
            properties: {
              autoUpgradeMinorVersion: false
              provisionAfterExtensions: []
              publisher: 'Microsoft.Compute'
              type: 'CustomScriptExtension'
              typeHandlerVersion: '1.9'
              settings: {
                fileUris: [
                  'https://ppvmsstgsa.blob.core.windows.net/init/buildvmInit.ps1'
                ]
                commandToExecute: 'powershell -ExecutionPolicy Unrestricted -File buildvmInit.ps1'
              }
            }
          }
        ]
      }
    }
  }
  zones: [
    '1'
    '2'
    '3'
  ]
}

As you can see I specified

identity: {    type: 'SystemAssigned'  }

And it is as written here

but it still disabled:

User's image

Azure Virtual Machine Scale Sets
Azure Virtual Machine Scale Sets
Azure compute resources that are used to create and manage groups of heterogeneous load-balanced virtual machines.
347 questions
{count} votes