QT-DevOps / AzureIssues

This repository is for questions
8 stars 27 forks source link

ResourceGroup - Not found error while running Azure CLI cmd as Shell Script #110

Open vn143 opened 3 years ago

vn143 commented 3 years ago

Hi,

Getting below error while executing azure cli cmd using shell script function. I tried changing the single/double quotes, but still no luck. If anyone tried on this, please help me to correct the same.

#!/bin/bash
create_subnet(){
    subent_address_prefixes= "$1"
    subnet_name='$2'
    rg_name= '$3'
    vnet_name= '$4'

    az network vnet subnet create --address-prefixes "$1"  --name '$2' --resource-group '$3' --vnet-name '$4'
}

# To create the resource group
az group create --name 'venkyRG' --location 'eastus'

# To create vnet and address space
az network vnet create --name 'venkyVNET' --resource-group 'venkyRG' --address-prefixes "172.32.0.0/16"

# To create ApplicationGatewaySubnet 
create_subnet '172.32.0.0/24' 'ApplicationGatewaySubnet' 'venkyRG' 'venkyVNET'

image