-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy-resources.ps1
47 lines (39 loc) · 1.81 KB
/
deploy-resources.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
# This script runs solution build.
Param(
[string] [Parameter(Mandatory=$true)] $TenantId,
[string] [Parameter(Mandatory=$true)] $SubscriptionId,
[string] [Parameter(Mandatory=$true)] $ClientId,
[string] [Parameter(Mandatory=$true)] $ClientSecret,
[string] [Parameter(Mandatory=$true)] $Environment,
[string] [Parameter(Mandatory=$true)] $Location,
[string] [Parameter(Mandatory=$true)] $LogStorageContainerSasToken,
[string] [Parameter(Mandatory=$true)] $FunctionAppKey
)
# Login to Azure
Write-Host "Logging into Azure ..." -ForegroundColor Green
$password = ConvertTo-SecureString $ClientSecret -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ($ClientId, $password)
$logged = Login-AzureRmAccount `
-ServicePrincipal `
-Tenant $TenantId `
-SubscriptionId $SubscriptionId `
-Credential $credential
Write-Host "Azure logged in" -ForegroundColor Green
# Deploy Azure resources
Write-Host "Deploying Azure resources ..." -ForegroundColor Green
$deployed = New-AzureRmResourceGroupDeployment `
-Name AppDeployment `
-ResourceGroupName $("yarm-rg-" + $Environment + "-" + $Location) `
-TemplateFile .\src\Yarm.ResourceGroup\app-deploy.json `
-TemplateParameterFile .\src\Yarm.ResourceGroup\app-deploy.parameters.json `
-environment $Environment `
-location $Location `
-logStorageContainerSasToken $LogStorageContainerSasToken `
-remoteDebuggingEnabled $true `
-functionAppKey $FunctionAppKey `
-applicationInsightsEnabled $true
Write-Host "Azure resources deployed" -ForegroundColor Green
Remove-Variable password
Remove-Variable credential
Remove-Variable logged
Remove-Variable deployed