Azure CLI 2-1
Azure CLI 2-1
0
The Azure CLI 2.0 is a command-line tool providing a great experience for managing Azure resources.
The CLI is designed to make scripting easy, query data, support long-running operations, and more.
The MSI distributable is used for installing, updating, and uninstalling the az command on
Windows.
When the installer asks if it can make changes to your computer, click the "Yes" box.
You can now run the Azure CLI with the az command from either Windows Command
Prompt or PowerShell. PowerShell offers some tab completion features not available from
Windows Command Prompt. To sign in, run the az login command.
** ) az login
1. If the CLI can open your default browser, it will do so and load a sign-in page.
2. Sign in with your account credentials in the browser.
Common commands
This table lists some common commands used in the CLI and links to their reference
documentation.
Virtual machines az vm
CosmosDB az cosmosdb
https://docs.microsoft.com/en-us/cli/azure/vm?view=azure-cli-latest
"id": "/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups/
janarg1",
"location": "westus",
"managedBy": null,
"name": "janarg1",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null
"id": "/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups/
janarg1",
"location": "westus",
"managedBy": null,
"name": "janarg1",
"properties": {
"provisioningState": "Succeeded"
},
"tags": null
"newVNet": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
},
"ddosProtectionPlan": null,
"dhcpOptions": {
"dnsServers": []
},
"enableDdosProtection": false,
"enableVmProtection": false,
"etag": "W/\"0d02f921-2339-4dbe-af8f-9940ff5b78b7\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/janarg1/providers/Microsoft.Network/virtualNetworks/janaVnet1",
"location": "westus",
"name": "janaVnet1",
"provisioningState": "Succeeded",
"resourceGroup": "janarg1",
"resourceGuid": "f51e564d-5652-4f33-bdac-7108adc3e2fe",
"subnets": [],
"tags": {},
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": []
"newVNet": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
},
"ddosProtectionPlan": null,
"dhcpOptions": {
"dnsServers": []
},
"enableDdosProtection": false,
"enableVmProtection": false,
"etag": "W/\"de111afd-0a64-4e42-983c-af27f93b5fae\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/janarg2/providers/Microsoft.Network/virtualNetworks/janaVnet2",
"location": "westus",
"name": "janaVnet2",
"provisioningState": "Succeeded",
"resourceGroup": "janarg2",
"resourceGuid": "e12109de-de0f-4993-9a6b-fe270f4cd1e3",
"subnets": [],
"tags": {},
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": []
[
{
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
},
"ddosProtectionPlan": null,
"dhcpOptions": {
"dnsServers": []
},
"enableDdosProtection": false,
"enableVmProtection": false,
"etag": "W/\"0d02f921-2339-4dbe-af8f-9940ff5b78b7\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/janarg1/providers/Microsoft.Network/virtualNetworks/janaVnet1",
"location": "westus",
"name": "janaVnet1",
"provisioningState": "Succeeded",
"resourceGroup": "janarg1",
"resourceGuid": "f51e564d-5652-4f33-bdac-7108adc3e2fe",
"subnets": [],
"tags": {},
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": []
},
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
},
"ddosProtectionPlan": null,
"dhcpOptions": {
"dnsServers": []
},
"enableDdosProtection": false,
"enableVmProtection": false,
"etag": "W/\"de111afd-0a64-4e42-983c-af27f93b5fae\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/janarg2/providers/Microsoft.Network/virtualNetworks/janaVnet2",
"location": "westus",
"name": "janaVnet2",
"provisioningState": "Succeeded",
"resourceGroup": "janarg2",
"resourceGuid": "e12109de-de0f-4993-9a6b-fe270f4cd1e3",
"subnets": [],
"tags": {},
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": []
},
"addressSpace": {
"addressPrefixes": [
"10.1.0.0/16"
]
},
"ddosProtectionPlan": null,
"dhcpOptions": null,
"enableDdosProtection": false,
"enableVmProtection": false,
"etag": "W/\"38083ce2-301b-4880-b91b-da7558d4661b\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/Vnet1",
"location": "southindia",
"name": "Vnet1",
"provisioningState": "Succeeded",
"resourceGroup": "testrg",
"resourceGuid": "d825381d-94a0-4956-b125-16a3b7c26c66",
"subnets": [
"addressPrefix": "10.1.0.0/24",
"etag": "W/\"38083ce2-301b-4880-b91b-da7558d4661b\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/Vnet1/subnets/sub1",
"ipConfigurations": [
"etag": null,
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/networkInterfaces/vm1272/
ipConfigurations/ipconfig1",
"name": null,
"privateIpAddress": null,
"privateIpAllocationMethod": null,
"provisioningState": null,
"publicIpAddress": null,
"resourceGroup": "testrg",
"subnet": null
],
"name": "sub1",
"networkSecurityGroup": null,
"provisioningState": "Succeeded",
"resourceGroup": "testrg",
"resourceNavigationLinks": null,
"routeTable": null,
"serviceEndpoints": null,
"type": "Microsoft.Network/virtualNetworks/subnets"
],
"tags": null,
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": [
"allowForwardedTraffic": false,
"allowGatewayTransit": false,
"allowVirtualNetworkAccess": true,
"etag": "W/\"38083ce2-301b-4880-b91b-da7558d4661b\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/Vnet1/
virtualNetworkPeerings/vnet1tovnet2",
"name": "vnet1tovnet2",
"peeringState": "Connected",
"provisioningState": "Succeeded",
"remoteAddressSpace": {
"addressPrefixes": [
"160.1.0.0/24"
},
"remoteVirtualNetwork": {
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/vnet2",
"resourceGroup": "testrg"
},
"resourceGroup": "testrg",
"type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
"useRemoteGateways": false
},
"addressSpace": {
"addressPrefixes": [
"160.1.0.0/24"
]
},
"ddosProtectionPlan": null,
"dhcpOptions": null,
"enableDdosProtection": false,
"enableVmProtection": false,
"etag": "W/\"b8fda351-1bfa-4b37-99a3-99306becc8e5\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/vnet2",
"location": "southindia",
"name": "vnet2",
"provisioningState": "Succeeded",
"resourceGroup": "testrg",
"resourceGuid": "e01e3cad-6b4c-4829-8e53-03b488f29ea2",
"subnets": [
"addressPrefix": "160.1.0.0/26",
"etag": "W/\"b8fda351-1bfa-4b37-99a3-99306becc8e5\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/
default",
"ipConfigurations": [
"etag": null,
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/networkInterfaces/vm2627/
ipConfigurations/ipconfig1",
"name": null,
"privateIpAddress": null,
"privateIpAllocationMethod": null,
"provisioningState": null,
"publicIpAddress": null,
"resourceGroup": "testrg",
"subnet": null
],
"name": "default",
"networkSecurityGroup": null,
"provisioningState": "Succeeded",
"resourceGroup": "testrg",
"resourceNavigationLinks": null,
"routeTable": null,
"serviceEndpoints": null,
"type": "Microsoft.Network/virtualNetworks/subnets"
],
"tags": null,
"type": "Microsoft.Network/virtualNetworks",
"virtualNetworkPeerings": [
"allowForwardedTraffic": false,
"allowGatewayTransit": false,
"allowVirtualNetworkAccess": true,
"etag": "W/\"b8fda351-1bfa-4b37-99a3-99306becc8e5\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/vnet2/
virtualNetworkPeerings/vnet2tovnet1",
"name": "vnet2tovnet1",
"peeringState": "Connected",
"provisioningState": "Succeeded",
"remoteAddressSpace": {
"addressPrefixes": [
"10.1.0.0/16"
},
"remoteVirtualNetwork": {
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/testrg/providers/Microsoft.Network/virtualNetworks/Vnet1",
"resourceGroup": "testrg"
},
"resourceGroup": "testrg",
"type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
"useRemoteGateways": false
0.0.0.0/24
"addressPrefix": "10.0.0.0/24",
"etag": "W/\"89f72ddc-f280-4e89-8ad7-8e82017d6398\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/janarg1/providers/Microsoft.Network/virtualNetworks/janaVnet1/subnets/
janaSubnet",
"ipConfigurations": null,
"name": "janaSubnet",
"networkSecurityGroup": null,
"provisioningState": "Succeeded",
"resourceGroup": "janarg1",
"resourceNavigationLinks": null,
"routeTable": null,
"serviceEndpoints": null,
"type": "Microsoft.Network/virtualNetworks/subnets"
}
PS C:\Users\JanardhanCh> az network vnet subnet create -g
janarg2 --vnet-name janaVnet2 -n janaSubnet2 --address-prefix
10.0.0.0/24
"addressPrefix": "10.0.0.0/24",
"etag": "W/\"f1515cfc-1395-4bdc-b064-188d326d917e\"",
"id":
"/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups
/janarg2/providers/Microsoft.Network/virtualNetworks/janaVnet2/subnets/
janaSubnet2",
"ipConfigurations": null,
"name": "janaSubnet2",
"networkSecurityGroup": null,
"provisioningState": "Succeeded",
"resourceGroup": "janarg2",
"resourceNavigationLinks": null,
"routeTable": null,
"serviceEndpoints": null,
"type": "Microsoft.Network/virtualNetworks/subnets"
"addressPrefix": "10.0.0.0/24",
"etag": "W/\"89f72ddc-f280-4e89-8ad7-8e82017d6398\"",
"id": "/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups/
janarg1/providers/Microsoft.Network/virtualNetworks/janaVnet1/subnets/janaSubnet",
"ipConfigurations": null,
"name": "janaSubnet",
"networkSecurityGroup": null,
"provisioningState": "Succeeded",
"resourceGroup": "janarg1",
"resourceNavigationLinks": null,
"routeTable": null,
"serviceEndpoints": null,
"type": "Microsoft.Network/virtualNetworks/subnets"
"addressPrefix": "10.0.0.0/24",
"etag": "W/\"89f72ddc-f280-4e89-8ad7-8e82017d6398\"",
"id": "/subscriptions/eca470dc-8964-4af9-83be-d2029767b9b8/resourceGroups/janarg1/providers/Microsoft.Network/
virtualNetworks/janaVnet1/subnets/janaSubnet",
"ipConfigurations": null,
"name": "janaSubnet",
"networkSecurityGroup": null,
"provisioningState": "Succeeded",
"resourceGroup": "janarg1",
"resourceNavigationLinks": null,
"routeTable": null,
"serviceEndpoints": null,
"type": "Microsoft.Network/virtualNetworks/subnets"