-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeploymentScript.ps1
63 lines (54 loc) · 1.77 KB
/
DeploymentScript.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
52
53
54
55
56
57
58
59
60
61
62
63
function Login
{
$needLogin = $true
Try
{
$content = Get-AzContext
if ($content)
{
$needLogin = ([string]::IsNullOrEmpty($content.Account))
}
}
Catch
{
if ($_ -like "*az login to login*")
{
$needLogin = $true
}
else
{
throw
}
}
if ($needLogin)
{
Connect-AzAccount
}
}
Write-Host 'Loging into Azure...'
Login
New-AzResourceGroup 'aad-access' "West Europe"
New-AzResourceGroupDeployment -ResourceGroupName 'aad-access' `
-TemplateFile ./src/AadAccess.RG/Templates/azuredeploy.json `
-TemplateParameterFile ./src/AadAccess.RG/Templates/azuredeploy.parameters.json
Write-Host "Set webapp auth..."
./src/AadAccess.RG/Scripts/SetWebAppAuth.ps1 -appName aad-access-api -resourceGroup aad-access
./src/AadAccess.RG/Scripts/SetWebAppAuth.ps1 -appName aad-access-functions -resourceGroup aad-access
Write-Host "Add AppId to App Settings..."
./src/AadAccess.RG/Scripts/AddAppIdToAppSettings.ps1 -webAppName aad-access-web `
-webAppResourceGroupName aad-access `
-aadAppName aad-access-api-access `
-appSettingName ApiAppId
./src/AadAccess.RG/Scripts/AddAppIdToAppSettings.ps1 -webAppName aad-access-web `
-webAppResourceGroupName aad-access `
-aadAppName aad-access-functions-access `
-appSettingName FunctionsAppId
Write-Host "Add WebApp to service principals in role..."
./src/AadAccess.RG/Scripts/AddAppToServicePrincipalInRole.ps1 `
-securedAppName aad-access-api-access `
-clientAppName aad-access-web `
-roleName SensitiveData
./src/AadAccess.RG/Scripts/AddAppToServicePrincipalInRole.ps1 `
-securedAppName aad-access-functions-access `
-clientAppName aad-access-web `
-roleName SensitiveData