5.4. Preparing for uploading Azure VHD images
This describes steps to upload an VHD image to Azure.
Prerequisites
- You must have a usable Azure resource group and storage account.
Procedure
Install python2:
# yum install python2
Notapython2 package must be installed because since the AZ CLI depends specifically on python 2.7
Import the Microsoft repository key:
# rpm --import https://packages.microsoft.com/keys/microsoft.asc
Create a local azure-cli repository information:
# sh -c 'echo -e "[azure-cli]\nname=Azure CLI\nbaseurl=https://packages.microsoft.com/yumrepos/azure-cli\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
Install the Azure CLI:
# yumdownloader azure-cli # rpm -ivh --nodeps azure-cli-2.0.64-1.el7.x86_64.rpm
NotaThe downloaded version of the Azure CLI package may vary depending on the current downloaded version.
Run the Azure CLI:
$ az login
The terminal shows the message 'Note, we have launched a browser for you to login. For old experience with device code, use "az login --use-device-code"' and opens a browser where you can login.
NotaIf you are running a remote (SSH) session, the link will not open in the browser. In this case, you can use the link provided and thus be able to login and autenticate your remote session. To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXXX to authenticate.
List the keys for the storage account in Azure:
$ GROUP=resource-group-name $ ACCOUNT=storage-account-name $ az storage account keys list --resource-group $GROUP --account-name $ACCOUNT
Replace resource-group-name with name of the Azure resource group and storage-account-name with name of the Azure storage account.
NotaYou can list the available resources using the command:
$ az resource list
Make note of value
key1
in the output of the previous command, and assign it to an environment variable:$ KEY1=value
Create a storage container:
$ CONTAINER=storage-account-name $ az storage container create --account-name $ACCOUNT \ --account-key $KEY1 --name $CONTAINER
Replace storage-account-name with name of the storage account.
Additional resources