PowerShell Desired State Configuration — Azure
Similar to Custom Script Extensions, if you want to automate the software installation onto virtual machine we can use PowerShell desired state configuration. The only difference between custom script extensions and PowerShell desired state configuration is that PowerShell desired state configuration can combine with other service called Azure Automation so if anyone uninstall the already installed software in that VM, it will make sure to reinstall that software.
You would need to upload below 2 configuration file in your azure storage account.
You would need to zip the PowerShell desired state configuration before uploading onto azure storage account.
Now go to Azure Portal → Virtual Machine → Select your newly created Virtual Machine → click on Extensions → Add → chose PowerShell Desired State Configuration → click on create
Once configurations are applied you will see the status as succeeded.
Now if you go to the public address of your virtual machine in browser you will see the IIS page in browser.
If you are getting any error in your browser then make sure that you have added the inbound rule for port 80. This can be found under networking section Inbound port rules.
Now to enable the Automation with PDSC we would need to create an automation account in Azure portal.
Now got to newly created automation account → State Configuration → Configuration → Add
and then upload the below ps1 file.
once the file is uploaded click on file and then click on compile.
Once the configuration has compiled you can add the node as part of this automation. You can select the VM on which you want to apply this state configuration.
Now if you go to the public address of your virtual machine in browser you will see the IIS page in browser.
You can go ahead an uninstall the IIS from server and then go to public address of your VM in browser you can still be able to access the IIS page.
Please follow me in LinkedIn :