-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdeploy.ps1
31 lines (22 loc) · 1.37 KB
/
deploy.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
param(
[string] $functionAppName,
[string] $location,
[string] $openAiEndpoint,
[string] $openAiKey
)
$error.Clear()
$ErrorActionPreference = 'Stop'
$resourceGroupName = $functionAppName + "-rg"
$storageAccountName = ($functionAppName + "storage").ToLower().Replace("-","").Replace("_","")
$cognitiveServicesAccountName = $functionAppName + "-cogsvcs"
Write-Host "Creating Resource Group $resourceGroupName in $location" -ForegroundColor Green
#write out the values for each variable
Write-Host "Function App Name: $functionAppName" -ForegroundColor Green
Write-Host "Location: $location" -ForegroundColor Green
Write-Host "Storage Account Name: $storageAccountName" -ForegroundColor Green
Write-Host "Cognitive Services Account Name: $cognitiveServicesAccountName" -ForegroundColor Green
Write-Host "Open AI Endpoint: $openAiEndpoint" -ForegroundColor Green
az deployment sub create --location $location --template-file ./infra/main.bicep --parameters resourceGroupName=$resourceGroupName location=$location functionAppName=$functionAppName storageAccountName=$storageAccountName cognitiveServicesAccountName=$cognitiveServicesAccountName openAiEndpoint=$openAiEndpoint openAiKey=$openAiKey -o table
if(!$?){ exit }
Write-Host "Publishing $functionAppName to $resourceGroupName" -ForegroundColor Green
func azure functionapp publish $functionAppName --dotnet-version "7.0" --csharp