DEV Community

Cover image for CLI command for creating Azure Resources
Abass Hamzat
Abass Hamzat

Posted on

CLI command for creating Azure Resources

  • Created VM , System assigned Identity using CLI
  1. Creating ResourceGR
  2. Create VM with system assigned ID az vm create \ --resource-group userRG \ --name userVM \ --image ubuntuLTS \ --generate-ssh-key \ --assign-identity \ --admin-username user \ --admin-password pass1234@ -----------------------------------------------------------------------------------------
  3. Created VM, User Assigned Identity using CLI
  4. Create ResourceRG (If you've not created before)
  5. Create the User Identity to be assigned to the VM
    az identity create --name bruno123 --resource-group saviourRG

  6. Create VM the user Identity assigned
    az vm create \
    --resource-group userRG \
    --name userVM --image ubuntuLTS \
    --generate-ssh-key \
    --assign-identity bruno123 \
    --admin-username user \
    --admin-password pass1234@


using variable to create KeyVault
myKeyVault=az204vault-$RANDOM
myLocation=

Creating Keyvault
az keyvault create --name $myKeyVault --resource-group az204-vault-rg --location $myLocation
Creating secretkey
az keyvault secret set --vault-name $myKeyVault --name "ExamplePassword" --value "hVFkk965BuUv"
To see check the secret
az keyvault secret show --name "ExamplePassword" --vault-name $myKeyVault


  • Delete Resource Groups Created (Cleaning UP)

    az group delete --name
    az group delete --name elodemoRG --no-wait
    az group delete --name demokeyvault --no-wait
    az group delete --name NetworkWatcherRG --no-wait


Link for online terminal for practice

Top comments (0)