Created
October 6, 2018 13:50
-
-
Save dbafromthecold/21d3939a7cc23cbe2e6a1b05e30d2689 to your computer and use it in GitHub Desktop.
delete_aci-virtualnetwork
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.microsoft.com/en-us/azure/container-instances/container-instances-vnet | |
# log into Azure | |
az login | |
# Set variables for resource group, virtual network, and subnet | |
RES_GROUP=containers1 | |
VNET=vnet1 | |
SUBNET=subnet1 | |
# Get network profile ID | |
NETWORK_PROFILE_ID=$(az network profile list --resource-group $RES_GROUP --query [0].id --output tsv) | |
# Delete the network profile | |
az network profile delete --id $NETWORK_PROFILE_ID -y | |
# Get the service association link (SAL) ID | |
SAL_ID=$(az network vnet subnet show --resource-group $RES_GROUP --vnet-name $VNET \ | |
--name $SUBNET --query id --output tsv)/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default | |
# Delete the default SAL ID for the subnet | |
az resource delete --ids $SAL_ID --api-version 2018-07-01 | |
# Delete the subnet delegation to Azure Container Instances | |
az network vnet subnet update --resource-group $RES_GROUP --vnet-name $VNET --name $SUBNET --remove delegations 0 | |
# Delete the subnet | |
az network vnet subnet delete --resource-group $RES_GROUP --vnet-name $VNET --name $SUBNET | |
# Delete virtual network | |
az network vnet delete --resource-group $RES_GROUP --name $VNET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment