Skip to content

Instantly share code, notes, and snippets.

@neerajks77
Last active October 11, 2021 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neerajks77/ef9eee8b4dff6adb5f445f65dade961f to your computer and use it in GitHub Desktop.
Save neerajks77/ef9eee8b4dff6adb5f445f65dade961f to your computer and use it in GitHub Desktop.
Configuration WebServer
{
param(
[Parameter(Mandatory=$true)]
[string] $NodeNames = "localhost",
[string] $AcctKey = "4PJREBT6kPMh9ejQwIhoU+vmOWdd7WYCVIhDEbttPPZVln8HerqOCQR+PTXlSMd0AZd4tVdRPIy/TEfos4aU9Q=="
)
Import-DscResource -ModuleName PsDesiredStateConfiguration
[String] $StorageAccountName = "linkedinautomation"
$secureacctKey = $AcctKey | ConvertTo-SecureString -AsPlainText -Force
$myStorageCredentials = New-Object System.Management.Automation.PSCredential ($StorageAccountName, $secureacctKey)
Node $NodeNames
{
# Make sure that IIS is installed
WindowsFeature IIS
{
Name = 'web-server'
Ensure = 'Present'
IncludeAllSubFeature = $true
}
# All the IISManagement Tools are also intalled
WindowsFeature IISMgmt
{
Ensure = "Present"
Name = "Web-Mgmt-Tools"
}
WindowsFeature ASPNet45
{
Name = "Web-ASP-Net45"
Ensure = "Present"
}
File ASPNetWebsite
{
Ensure = "Present"
Credential = $myStorageCredentials
SourcePath = "\\linkedinautomation.file.core.windows.net\configurevms"
DestinationPath = "C:\inetpub\wwwroot"
Recurse = $true
Type = "Directory"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment