-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateContainer.ps1
More file actions
31 lines (26 loc) · 966 Bytes
/
Copy pathCreateContainer.ps1
File metadata and controls
31 lines (26 loc) · 966 Bytes
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
# Define container properties
$resourceGroupName = ""
$containerInstanceName = ""
$imageName = ""
# Define container registry credentials
$REGISTRY = ""
$USERNAME = ""
$TENANT_ID = ""
$PASSWORD = ""
# Define secure environment variables
$VM_NAME = ""
$RESOURCE_GROUP = ""
$ADMIN_ROLE_ID =
$TENANT_ID = ""
$CLIENT_ID = ""
$SUBSCRIPTION_ID = ""
$CLIENT_SECRET = ""
$TOKEN = ""
# Login to Azure/ACR
az login --tenant $TENANT_ID
az acr login --name $REGISTRY
# Tag and push image to ACR
docker tag $containerInstanceName $imageName
docker push $imageName
# Create Container
az container create -g $resourceGroupName --name $containerInstanceName --image $imageName --ports 443 --registry-username $USERNAME --registry-password $PASSWORD --secure-environment-variables VM_NAME=$VM_NAME RESOURCE_GROUP=$RESOURCE_GROUP ADMIN_ROLE_ID=$ADMIN_ROLE_ID TENANT_ID=$TENANT_ID CLIENT_ID=$CLIENT_ID SUBSCRIPTION_ID=$SUBSCRIPTION_ID CLIENT_SECRET=$CLIENT_SECRET TOKEN=$TOKEN