Exercise - Import and compile
After creating your DSC configuration file, you must import it and compile it to the DSC pull server. Compiling will create the MOF file. Read more about it at Compiling a DSC Configuration with the Azure portal.
Import and compile configurations
To import and compile a configuration, complete the following high-level steps:
Create a configuration file by creating a file on your local machine. Then, copy and paste the following PowerShell code into the file, and name it LabConfig.ps1. This script configuration will ensure the IIS web-server role is installed on the servers:
configuration LabConfig { Node WebServer { WindowsFeature IIS { Ensure = 'Present' Name = 'Web-Server' IncludeAllSubFeature = $true } } }
In Azure Automation, account under Configuration Management > State configuration (DSC), select the Configurations tab, and select +Add.
Point to the configuration file you want to import, and then select OK.
Once imported, double click the file, select Compile, and then confirm by selecting Yes.
Once compiled, verify that the file has a status of completed.
Note
If you prefer, you can also use the PowerShell Start-AzAutomationDscCompilationJob cmdlet. More information about this method is available at Compiling a DSC Configuration with Windows PowerShell.