Skip to content

Instantly share code, notes, and snippets.

@CodeHeight
Created May 7, 2018 14:47
Show Gist options
  • Save CodeHeight/c20386d61bb968e39d72c95b11a6f5ff to your computer and use it in GitHub Desktop.
Save CodeHeight/c20386d61bb968e39d72c95b11a6f5ff to your computer and use it in GitHub Desktop.
DSC and Custom Scripts (Manageing Virtual Machines > Configuration Management Tools)
get-windowsfeature web-server | install-windowsfeature
$resourceGroup = "vms"
$location = "eastus2"
$vmName = "configureme"
$storageName = "codeheightStore"
#Publish the configuration script into user storage
Publish-AzureRmVMDscConfiguration -ConfigurationPath .\webserverinstall.ps1 -ResourceGroupName $resourceGroup -StorageAccountName $storageName -force
#Set the VM to run the DSC configuration
Set-AzureRmVmDscExtension -Version 2.21 -ResourceGroupName $resourceGroup -VMName $vmName -ArchiveStorageAccountName $storageName -ArchiveBlobName webserverinstall.ps1.zip -AutoUpdate:$true -ConfigurationName "IISInstall"
configuration IISInstall
{
node "localhost"
{
WindowsFeature IIS
{
Ensure = "Present"
Name = "web-Server"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment