0

how to execute ARM template whenever System Managed Identity is turned on VMSS (Virtual Machine Scale Set).

dev4java
  • 86
  • 1
  • 8
  • is it an existing VMSS for which you want to update the identity part using ARM template? – Ansuman Bal Feb 17 '22 at 06:14
  • @AnsumanBal-MT Yes we want to do for existing VMSS – dev4java Feb 17 '22 at 13:11
  • @AnsumanBal-MT Your template looks like to turn on the Managed identify, but our requirement is something like event/trigger, whenever system identity is turned on my ARM template should be executed automatically – dev4java Feb 19 '22 at 08:12

1 Answers1

0

You can use the below template for your requirement:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "type": "String"
        },
        "virtualMachineScaleSetName": {
            "type": "String"
        }
    },
    "variables": {
        "virtualMachineScaleSetApiVersion": "2021-04-01"
    },
    "resources": [
        {
            "type": "Microsoft.Compute/virtualMachineScaleSets",
            "apiVersion": "[variables('virtualMachineScaleSetApiVersion')]",
            "name": "[parameters('virtualMachineScaleSetName')]",
            "location": "[parameters('location')]",
            "identity": {
                "type" : "SystemAssigned"
            }
        }
    ]
}

Existing VMSS:

enter image description here

Running the Template:

enter image description here

Output:

enter image description here

Ansuman Bal
  • 9,705
  • 2
  • 10
  • 27