Working with the CLI

A third option to operate Azure Stack is the Command Line Interface (CLI), which is available for:

  • Windows
  • Linux
  • Mac

Now, let's have a look at how to create a virtual machine using the CLI. At first, we would need to register the corresponding environment:

  • As administrative environment, you would need to run the following script:
az cloud register 
-n AzureStackAdmin
--endpoint-resource-manager
"https://adminmanagement.local.azurestack.external"

--suffix-storage-endpoint "local.azurestack.external"
--suffix-keyvault-dns ".adminvault.local.azurestack.external"
--endpoint-vm-image-alias-doc <URI of the document which
contains virtual machine image aliases>

az cloud set
-n AzureStackAdmin
  • As user environment, the following script could help:
az cloud register 
-n AzureStackUser
--endpoint-resource-manager
"https://management.local.azurestack.external"

--suffix-storage-endpoint "local.azurestack.external"
--suffix-keyvault-dns ".vault.local.azurestack.external"
--endpoint-vm-image-alias-doc <URI of the document which
contains virtual machine image aliases>

az cloud set
-n AzureStackUser
  • Now, let's log on to the Azure Stack environment with the following command:
az login 
-u <Active directory global administrator or user account. For example: username@<aadtenant>.onmicrosoft.com>
--tenant <Azure Active Directory Tenant name. For example: myazurestack.onmicrosoft.com>
  • And finally, let's create a virtual machine:
az group create --name myResourceGroup --location local
az vm create
--resource-group "myResourceGroup"
--name "myVM"
--image "Win2016Datacenter"
--admin-username "Demouser"
--admin-password "Demouser@123"
--use-unmanaged-disk
--location local
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset