(Desired state configuration) extension

Swathi Reddy 186 Reputation points
2020-12-10T10:12:32.927+00:00

I have created an ARM template to create a vm name with specified OS but unable to get it with a DNS name and DSC extension.
Really need this to be done as I am new to this DSC extensions and ARM template, PowerShell DSC extension

Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
256 questions
{count} votes

Accepted answer
  1. svijay-MSFT 5,201 Reputation points Microsoft Employee
    2020-12-14T11:29:02.663+00:00

    Hello @swabha,

    Per my understanding you would like to enable the DSC Extension and also DNS Name for the VM in the ARM Template. Sharing my below research and findings :

    DSC Extension

    For the DSC Extension you could use the below refer the article

    The below that needs to be added to the resources section of the ARM Template.

    {  
      "type": "Microsoft.Compute/virtualMachines/extensions",  
      "name": "Microsoft.Powershell.DSC",  
      "apiVersion": "2018-06-30",  
      "location": "[parameters('location')]",  
      "dependsOn": [  
        "[concat('Microsoft.Compute/virtualMachines/', parameters('VMName'))]"  
      ],  
      "properties": {  
        "publisher": "Microsoft.Powershell",  
        "type": "DSC",  
        "typeHandlerVersion": "2.77",  
        "autoUpgradeMinorVersion": true,  
        "protectedSettings": {  
          "Items": {  
            "registrationKeyPrivate": "[listKeys(resourceId('Microsoft.Automation/automationAccounts/', parameters('automationAccountName')), '2018-06-30').Keys[0].value]"  
          }  
        },  
        "settings": {  
          "Properties": [  
            {  
              "Name": "RegistrationKey",  
              "Value": {  
                "UserName": "PLACEHOLDER_DONOTUSE",  
                "Password": "PrivateSettingsRef:registrationKeyPrivate"  
              },  
              "TypeName": "System.Management.Automation.PSCredential"  
            },  
            {  
              "Name": "RegistrationUrl",  
              "Value": "[reference(concat('Microsoft.Automation/automationAccounts/', parameters('automationAccountName'))).registrationUrl]",  
              "TypeName": "System.String"  
            },  
            {  
              "Name": "NodeConfigurationName",  
              "Value": "[parameters('nodeConfigurationName')]",  
              "TypeName": "System.String"  
            }  
          ]  
        }  
      }  
    }  
    

    Also, You could refer this blog and this blog for more step by step information.

    DNS Name

    For DNS Name, you could mention the below setting in addition to the VM Properties.

    47972-image.png

    You could refer to this doc for a sample template.

    Please feel free to let me know if you have any questions or concerns.


0 additional answers

Sort by: Most helpful