-
Notifications
You must be signed in to change notification settings - Fork 22
/
ContosoWebsite.ps1
51 lines (47 loc) · 1.32 KB
/
ContosoWebsite.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Configuration ContosoWebsite
{
param ($MachineName)
Node $MachineName
{
#Install the IIS Role
WindowsFeature IIS
{
Ensure = �Present�
Name = �Web-Server�
}
#Install ASP.NET 4.5
WindowsFeature ASP
{
Ensure = �Present�
Name = �Web-Asp-Net45�
}
WindowsFeature WebServerManagementConsole
{
Name = "Web-Mgmt-Console"
Ensure = "Present"
}
Script DeployWebPackage
{
GetScript = {@{Result = "DeployWebPackage"}}
TestScript = {
if((Test-Path "C:\inetpub\wwwroot\Global.asax") -eq $true)
{
return $true
}
else
{
return $false
}
}
SetScript ={
[system.io.directory]::CreateDirectory("C:\WebApp")
$dest = "C:\WebApp\Site.zip"
Remove-Item -path "C:\inetpub\wwwroot" -Force -Recurse -ErrorAction SilentlyContinue
Invoke-WebRequest "https://raw.githubusercontent.com/azurecitadel/azure-security-lab/master/ContosoWeb.zip" -OutFile $dest
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::ExtractToDirectory($dest, "C:\inetpub\wwwroot")
}
DependsOn = "[WindowsFeature]IIS"
}
}
}