Sunday, June 5, 2022

Azure DevOps - PowerShell Desired State Configuration - Extension - Resources

Azure DevOps - PowerShell Desired State Configuration - Extension - Resources

 Create a Windows VM and open port 80 in the Azure portal.

 Create a file named WebRole.ps1 and add the following contents

  1. Configuration DScConfiguration {
  2. Node $AllNodes.Where{$_.Role -eq "WebServer"}.NodeName
  3. {
  4. WindowsFeature IISInstall {
  5. Ensure = 'Present'
  6. Name = 'Web-Server'
  7. }
  8.  
  9. }}

 You need to zip this file

 Create a data configuration file as InstallWebconfig.psd1 and add the following contents

  1. @{
  2. AllNodes = @(
  3.  
  4. @{
  5. NodeName = "localhost"
  6. Role = "WebServer"
  7. }
  8. )
  9. }

Upload these files to a storage account.

In the VM select Extensions + applications and Add PowerShell Desired Configuration with the below details.



Click on Review + Create

Once the extension is added then you can browse the default IIS Page on the browser with VM public IP Address.

0 comments:

Post a Comment