forked from gderossilive/AIOps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunMe - Test.azcli
More file actions
48 lines (35 loc) · 1.92 KB
/
RunMe - Test.azcli
File metadata and controls
48 lines (35 loc) · 1.92 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
#!/bin/bash
# IMPORTANT: before to start to execute this script, you need to create a .env file with the following content:
# MySubscriptionId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# MyObjectId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# MyTenantId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# location=<your favorite location>
# Refer to the .env.sample file for an example
# import environment variables from .env file
source .env
subscriptionID=$(az account show --query id -o tsv)
if [ "$subscriptionID" != "$MySubscriptionId" ]; then
echo "You are not in the correct subscription. Please login."
az login --tenant $MyTenantId --use-device-code
az account set --subscription $MySubscriptionId # MCAPS tenant
fi
# input variable Seed
read -p "Enter the Seed value: " Seed
# find the Application ID of the service principal
CopSp_id=$(az ad sp list --display-name "CopilotReaderSP-$Seed" --query "[0].appId" -o tsv)
# find the secret value in the key vault
CopSp_pwd=$(az keyvault secret show --name "SP-Secret" --vault-name "KV-$Seed" --query "value" -o tsv)
# find the name of the key vault
KVname=$(az deployment sub show --name "CoreDeploy-$Seed" --query properties.outputs.kvName.value -o tsv)
# find the name of the log analytics workspace
LAWname=$(az deployment sub show --name "CoreDeploy-$Seed" --query properties.outputs.laWname.value -o tsv)
openAICustomDomainName=$(az deployment group show --name "OpenAIDeploy-$Seed" --resource-group "$Seed-Demo" --query properties.outputs.openAIName.value -o tsv)
openAIdeploymentName=$(az deployment group show --name "OpenAIDeploy-$Seed" --resource-group "$Seed-Demo" --query properties.outputs.openAIdeploymentName.value -o tsv)
echo "Client ID: $CopSp_id
Client Secret: $CopSp_pwd
Tenant ID: $MyTenantId
Key Vault Name: $KVname
Log Analytics Workspace Name: $LAWname
Resource Group Name: $Seed-Demo
OpenAI Service Name: $openAICustomDomainName
OpenAI Deployment Name: $openAIdeploymentName"