title: DSC ConfigurationData parameter in Azure ARM template deployment
body: <p>I am deploying a resource group by using the Azure REST API and supplying the ARM templates. In the virtual machine resource, I have an extension that is of type <code>DSC</code>. The code snippet is as follows:</p>
  
  <pre><code>{
    "resources": [
      {
        "name": "[concat(variables('VMName'),'/SetupScript')]",
        "type": "Microsoft.Compute/virtualMachines/extensions",
        "location": "[parameters('DNSLocation')]",
        "apiVersion": "2015-05-01-preview",
        "dependsOn": [
          "[concat('Microsoft.Compute/virtualMachines/', variables('VMName'))]"
        ],
        "tags": {
          "displayName": "SetupScript"
        },
        "properties": {
          "publisher": "Microsoft.Powershell",
          "type": "DSC",
          "typeHandlerVersion": "1.7",
          "settings": {
            "modulesUrl": "[variables('SetupScriptConfigurationFile')]",
            "sasToken": "",
            "configurationFunction": "[variables('SetupScriptConfigurationFunction')]",
            "properties": {
              "DomainName": "[parameters('DomainName')]",
              "DomainAdminUsername": "[parameters('VMAdminUsername')]",
              "DomainAdminPassword": "[parameters('VMAdminPassword')]"
            }
          },
          "protectedSettings": {
  
          }
        }
      }
    ]
  }
  </code></pre>
  
  <p>The DSC configuration that is being called is shown bellow:</p>
  
  <pre><code>Configuration DNSConfig
  { 
      param
      ( 
          [string]$NodeName ='localhost',  
          [Parameter(Mandatory=$true)][string]$DomainName,
          [Parameter(Mandatory=$true)][string]$DomainAdminUsername,
          [Parameter(Mandatory=$true)][string]$DomainAdminPassword
      ) 
  
      #Import the required DSC Resources  
      Import-DscResource -Module xComputerManagement 
      Import-DscResource -Module xActiveDirectory
  
      $securePassword = ConvertTo-SecureString -AsPlainText $DomainAdminPassword -Force;
      $DomainAdminCred = New-Object System.Management.Automation.PSCredential($DomainAdminUsername, $securePassword);
  
      Node $NodeName
      { #ConfigurationBlock
  
          WindowsFeature DSCService {
              Name = "DSC-Service"
              Ensure = "Present"
              IncludeAllSubFeature = $true
          }
  
          WindowsFeature ADDSInstall 
          {   
              Ensure = 'Present'
              Name = 'AD-Domain-Services'
              IncludeAllSubFeature = $true
          }
  
          WindowsFeature RSATTools 
          { 
              DependsOn= '[WindowsFeature]ADDSInstall'
              Ensure = 'Present'
              Name = 'RSAT-AD-Tools'
              IncludeAllSubFeature = $true
          }  
  
          xADDomain SetupDomain {
              DomainName= $DomainName
              DomainAdministratorCredential= $DomainAdminCred
              SafemodeAdministratorPassword= $DomainAdminCred
              DependsOn='[WindowsFeature]RSATTools'
          }
      #End Configuration Block    
      } 
  }
  </code></pre>
  
  <p>WHen I run the DSC script locally, to successfully generate the MOF file for this DSC Script, I need to pass in a hashtable for the ConfigurationData like so:</p>
  
  <pre><code>$ConfigData = @{
      AllNodes = @(
          @{
              NodeName                    = '*'
              PSDscAllowPlainTextPassword = $true
          }
      )
  }
  
  DNSConfig -ConfigurationData $ConfigData -DomainName "mydomain.com" ...
  </code></pre>
  
  <p><strong>My problem now is that, I want to pass this type of <code>ConfigurationData</code> through the ARM template that I showed first. Is it even possible? If not, then how should I set the ConfigurationData of the DSC Script that is executed by the VM Extension?</strong></p>
  
  <p>Thanks!</p>