Deploy with Visual Studio Code to Azure Stack Hub
You can use Visual Studio Code and the Azure Resource Manager Tools extension to create and edit Azure Resource Manager templates that will work with your version of Azure Stack Hub. You can create Resource Manager templates in Visual Studio Code without the extension, but the extension provides autocomplete options that simplify template development. In addition, you can specify a deployment schema that will help you understand the resources available on Azure Stack Hub.
In this article, you will deploy a Windows virtual machine.
Concepts for Azure Stack Hub Resource Manager
Azure Stack Hub Resource Manager
To understand the concepts associated with deploying and managing your Azure solutions in Azure Stack Hub, see Use Azure Resource Manager templates in Azure Stack Hub.
To understand the concepts associated with coordinating resource providers on Azure Stack Hub see Manage API version profiles in Azure Stack Hub.
The deployment schema
The Azure Stack Hub deployment schema supports hybrid profiles through Azure Resource Manager templates in Visual Studio Code. You can change one line in the JSON template to reference the schema, and then you can then use IntelliSense to review Azure compatible resource. With the schema, review the resource providers, types, and API versions supported within your version of Azure Stack Hub. The schema depends on the API profile to retrieve the specific versions of the API endpoints in the resource providers supported in your version of Azure Stack Hub. You can use the word completion for type and apiVersion, and then you will be limited to the apiVersion and resource types available to the API profile.
- Visual Studio Code
- Access to Azure Stack Hub
- Azure Stack Hub PowerShell installed on a machine that reaches the management endpoints
Install Resource Manager Tools extension
To install the Resource Manager Tools extension, use these steps:
- Open Visual Studio Code.
- Press CTRL+SHIFT+X to open the Extensions pane
- Search for
Azure Resource Manager Tools, and then select Install.
- Select Reload to finish the extension installation.
Get a template
Instead of creating a template from scratch, you open a template from the
AzureStack-QuickStart-Templates. AzureStack-QuickStart-Templates is a repository for Resource Manager templates that deploy resources to Azure Stack Hub.
The template in this article called
101-vm-windows-create. The template defines a basic deployment of a Windows VM to Azure Stack Hub. This template also deploys a virtual network (with DNS), network security group, and a network interface.
Open Visual Studio Code and navigate to a working folder on your machine.
Open the Git bash terminal in Visual Studio Code.
Run the following command to retrieve the Azure Stack Hub Quickstart repository.
git clone https://github.com/Azure/AzureStack-QuickStart-Templates.git
Open the directory containing the repository.
Select Open to open the file at
/101-vm-windows-create/azuredeploy.jsonin the repository.
Save the file into your own workspace, or if you have created a branch of the repository you can work in place.
When you ready, you can deploy your template using PowerShell. Follow the instructions at Deploy with PowerShell. Specify the location of the template in the script.
After you have deployed your Windows VM, navigate to the Azure Stack Hub portal, and find the resource group. If you want to clear the result of this exercise from your Azure Stack Hub, delete the resource group.