Skip to content

Commit 55929e0

Browse files
authored
Merge pull request #4 from North-Seattle-College/development
update fork
2 parents 0627943 + 55a5979 commit 55929e0

File tree

3 files changed

+288
-0
lines changed

3 files changed

+288
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"AWSTemplateFormatVersion": "2010-09-09",
3+
"Resources": {
4+
"S3Bucket": {
5+
"Type": "AWS::S3::Bucket",
6+
"Properties": {
7+
"AccessControl": "PublicRead",
8+
"BucketName": "enterbucketname",
9+
"WebsiteConfiguration": {
10+
"IndexDocument": "index.html",
11+
"ErrorDocument": "error.html"
12+
}
13+
},
14+
"DeletionPolicy": "Retain"
15+
},
16+
"BucketPolicy": {
17+
"Type": "AWS::S3::BucketPolicy",
18+
"Properties": {
19+
"PolicyDocument": {
20+
"Id": "MyPolicy",
21+
"Version": "2012-10-17",
22+
"Statement": [
23+
{
24+
"Sid": "PublicReadForGetBucketObjects",
25+
"Effect": "Allow",
26+
"Principal": "*",
27+
"Action": "s3:GetObject",
28+
"Resource": {
29+
"Fn::Join": [
30+
"",
31+
[
32+
"arn:aws:s3:::",
33+
{
34+
"Ref": "S3Bucket"
35+
},
36+
"/*"
37+
]
38+
]
39+
}
40+
}
41+
]
42+
},
43+
"Bucket": {
44+
"Ref": "S3Bucket"
45+
}
46+
}
47+
}
48+
},
49+
"Outputs": {
50+
"WebsiteURL": {
51+
"Value": {
52+
"Fn::GetAtt": [
53+
"S3Bucket",
54+
"WebsiteURL"
55+
]
56+
},
57+
"Description": "URL for website hosted on S3"
58+
},
59+
"S3BucketSecureURL": {
60+
"Value": {
61+
"Fn::Join": [
62+
"",
63+
[
64+
"https://",
65+
{
66+
"Fn::GetAtt": [
67+
"S3Bucket",
68+
"DomainName"
69+
]
70+
}
71+
]
72+
]
73+
},
74+
"Description": "Name of S3 bucket to hold website content"
75+
}
76+
}
77+
}

Automation/Task6/AppGateway.ps1

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
param(
2+
3+
# Login parameters
4+
[string] [Parameter(Mandatory=$true)] $tenantId,
5+
[string] [Parameter(Mandatory=$true)] $applicationId,
6+
[string] [Parameter(Mandatory=$true)] $secret,
7+
[string] [Parameter(Mandatory=$true)] $subscriptionId,
8+
9+
# parameters
10+
[string] [Parameter(Mandatory=$true)] $resourceGroupName,
11+
[string] [Parameter(Mandatory=$true)] $location,
12+
[string] [Parameter(Mandatory=$true)] $applicationGatewayName
13+
14+
)
15+
16+
Start-Transcript -Path "$PSScriptRoot\create_Azure_log.log"
17+
Write-Host "Logging to $PSScriptRoot\create_Azure_log.log"
18+
19+
20+
# Imports Login Module
21+
Import-Module ..\Login
22+
# Path to Template File
23+
$templateFilePath = "./template.json"
24+
25+
# Login Inputs
26+
Login $tenantId $applicationId $secret $subscriptionId
27+
28+
29+
# Creates/Updates resource group
30+
New-AzResourceGroup -Name $ResourceGroupName -Location $Location -Force
31+
32+
33+
#Creates New Application Gateway
34+
$sku = New-AzApplicationGatewaySku `
35+
-Name Standard_v2 `
36+
-Tier Standard_v2 `
37+
-Capacity 2
38+
New-AzApplicationGateway `
39+
-Name $applicationGatewayName `
40+
-ResourceGroupName $resourceGroupName `
41+
-TemplateFile $templateFilePath `
42+
-Location $location `
43+
-BackendAddressPools $backendAddressPools `
44+
-BackendHttpSettingsCollection $backendHttpSettingsCollection `
45+
-FrontendIpConfigurations $frontendIPConfigurations `
46+
-GatewayIpConfigurations $gatewayIPConfigurations `
47+
-FrontendPorts $frontendPorts `
48+
-HttpListeners $httpListeners `
49+
-RequestRoutingRules $requestRoutingRules `
50+
-Sku $sku

Automation/Task6/template.json

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"location": {
6+
"type": "string"
7+
},
8+
"applicationGatewayName": {
9+
"type": "string"
10+
},
11+
"tier": {
12+
"type": "string"
13+
},
14+
"skuSize": {
15+
"type": "string"
16+
},
17+
"capacity": {
18+
"type": "int",
19+
"defaultValue": 2
20+
},
21+
"subnetName": {
22+
"type": "string"
23+
},
24+
"zones": {
25+
"type": "array"
26+
},
27+
"virtualNetworkName": {
28+
"type": "string"
29+
},
30+
"virtualNetworkPrefix": {
31+
"type": "array"
32+
}
33+
},
34+
"variables": {
35+
"vnetId": "[resourceId('nsc-rg-ag-westus2-thur','Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]",
36+
"publicIPRef": "/subscriptions/9f4dcf43-aa06-457b-b975-f0216baef20d/resourceGroups/loanlpautomationlab01-rg/providers/Microsoft.Network/publicIPAddresses/frondendIP",
37+
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]",
38+
"applicationGatewayId": "[resourceId('Microsoft.Network/applicationGateways', parameters('applicationGatewayName'))]"
39+
},
40+
"resources": [
41+
{
42+
"name": "[parameters('applicationGatewayName')]",
43+
"type": "Microsoft.Network/applicationGateways",
44+
"apiVersion": "2019-09-01",
45+
"location": "[parameters('location')]",
46+
"zones": "[parameters('zones')]",
47+
"dependsOn": [
48+
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
49+
],
50+
"tags": {},
51+
"properties": {
52+
"sku": {
53+
"name": "[parameters('skuSize')]",
54+
"tier": "[parameters('tier')]",
55+
"capacity": "[parameters('capacity')]"
56+
},
57+
"gatewayIPConfigurations": [
58+
{
59+
"name": "appGatewayIpConfig",
60+
"properties": {
61+
"subnet": {
62+
"id": "[variables('subnetRef')]"
63+
}
64+
}
65+
}
66+
],
67+
"frontendIPConfigurations": [
68+
{
69+
"name": "appGwPublicFrontendIp",
70+
"properties": {
71+
"PublicIPAddress": {
72+
"id": "[variables('publicIPRef')]"
73+
}
74+
}
75+
}
76+
],
77+
"frontendPorts": [
78+
{
79+
"name": "port_80",
80+
"properties": {
81+
"Port": 80
82+
}
83+
}
84+
],
85+
"backendAddressPools": [
86+
{
87+
"name": "nsc_ag_westus2_bp",
88+
"properties": {
89+
"backendAddresses": []
90+
}
91+
}
92+
],
93+
"backendHttpSettingsCollection": [
94+
{
95+
"name": "nsc_ag_westus2_http",
96+
"properties": {
97+
"Port": 80,
98+
"Protocol": "Http",
99+
"cookieBasedAffinity": "Disabled",
100+
"requestTimeout": 20
101+
}
102+
}
103+
],
104+
"httpListeners": [
105+
{
106+
"name": "nsc_ag_westus2_l",
107+
"properties": {
108+
"frontendIPConfiguration": {
109+
"id": "[concat(variables('applicationGatewayId'), '/frontendIPConfigurations/appGwPublicFrontendIp')]"
110+
},
111+
"frontendPort": {
112+
"id": "[concat(variables('applicationGatewayId'), '/frontendPorts/port_80')]"
113+
},
114+
"protocol": "Http",
115+
"sslCertificate": null
116+
}
117+
}
118+
],
119+
"requestRoutingRules": [
120+
{
121+
"Name": "nsc_ag_westus2_rrl",
122+
"properties": {
123+
"RuleType": "Basic",
124+
"httpListener": {
125+
"id": "[concat(variables('applicationGatewayId'), '/httpListeners/nsc_ag_westus2_l')]"
126+
},
127+
"backendAddressPool": {
128+
"id": "[concat(variables('applicationGatewayId'), '/backendAddressPools/nsc_ag_westus2_bp')]"
129+
},
130+
"backendHttpSettings": {
131+
"id": "[concat(variables('applicationGatewayId'), '/backendHttpSettingsCollection/nsc_ag_westus2_http')]"
132+
}
133+
}
134+
}
135+
],
136+
"enableHttp2": false,
137+
"sslCertificates": [],
138+
"probes": []
139+
}
140+
},
141+
{
142+
"apiVersion": "2019-09-01",
143+
"type": "Microsoft.Network/virtualNetworks",
144+
"name": "[parameters('virtualNetworkName')]",
145+
"location": "[parameters('location')]",
146+
"properties": {
147+
"addressSpace": {
148+
"addressPrefixes": "[parameters('virtualNetworkPrefix')]"
149+
},
150+
"subnets": [
151+
{
152+
"name": "default",
153+
"properties": {
154+
"addressPrefix": "172.19.0.0/24"
155+
}
156+
}
157+
]
158+
}
159+
}
160+
]
161+
}

0 commit comments

Comments
 (0)