Skip Navigation


Azure Compute sample for creating a virtual machine using custom vm image - - Create a virtual machine - Delete a virtual machine.

Running this Sample

To run this sample:

  1. Add a custom virtual machine image to Azure Stack. Make a note of the blob storage URI where you upload the image. The blob storage URI has the following format: <storageAccount>/<blobContainer>/<targetVHDName>.vhd.

  2. Clone the repository using the following command:

    git clone

  3. Create an Azure service principal and assign a role to access the subscription. For instructions on creating a service principal, see Use Azure PowerShell to create a service principal with a certificate.

  4. Set the following required environment variable values:

    • AZURE_CUSTOM_IMAGE_URL (Blob storage URI value from Step 1)
  5. Change directory to Hybrid sample:

    • cd hybrid-compute-java-create-vm-from-custom-image
  6. Run the sample:

    • mvn clean compile exec:java

More information

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact with any additional questions or comments.