-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDeploy-Infrastructure.ps1
More file actions
48 lines (42 loc) · 1.77 KB
/
Deploy-Infrastructure.ps1
File metadata and controls
48 lines (42 loc) · 1.77 KB
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
<#
.SYNOPSIS
Deploy the core infrastructure for the OpenAI API Management Load Balancing Sample to an Azure subscription.
.DESCRIPTION
This script initiates the deployment of the main.bicep template to the current default Azure subscription,
determined by the Azure CLI. The deployment name and location are required parameters.
.PARAMETER DeploymentName
The name of the deployment to create in an Azure subscription.
.PARAMETER Location
The location to deploy the Azure resources to.
.PARAMETER PublisherEmail
The email address of the API Management publisher.
.PARAMETER PublisherName
The name of the API Management publisher.
.EXAMPLE
.\Deploy-Infrastructure.ps1 -DeploymentName 'my-deployment' -Location 'westeurope' -PublisherEmail 'test@email.com' -PublisherName 'Test User'
.NOTES
Author: James Croft
Date: 2024-03-27
#>
param
(
[Parameter(Mandatory = $true)]
[string]$DeploymentName,
[Parameter(Mandatory = $true)]
[string]$Location,
[Parameter(Mandatory = $true)]
[string]$PublisherEmail,
[Parameter(Mandatory = $true)]
[string]$PublisherName
)
Write-Host "Deploying infrastructure..."
Set-Location -Path $PSScriptRoot
az --version
$deploymentOutputs = (az deployment sub create --name $DeploymentName --location $Location --template-file './infra/main.bicep' --parameters './infra/main.parameters.json' `
--parameters workloadName=$DeploymentName `
--parameters location=$Location `
--parameters apiManagementPublisherEmail=$PublisherEmail `
--parameters apiManagementPublisherName=$PublisherName `
--query 'properties.outputs' -o json) | ConvertFrom-Json
$deploymentOutputs | ConvertTo-Json | Out-File -FilePath './InfrastructureOutputs.json' -Encoding utf8
return $deploymentOutputs