Enter the VM folder:
cd virtual-machine
Example creating Virtual Machines using ARM Templates.
You'll need to have either PowerShell Azure Extensions or Azure CLI.
For this example you create the resource group separately (or reuse one you have).
# PowerShell
$resourceGroupName="your-resource-group-name"
$location="eastus2"
Connect-AzAccount
New-AzResourceGroup -Name $resourceGroupName -Location $location
# Azure CLI
resourceGroupName="your-resource-group-name"
location="eastus2"
az login
az group create --name $resourceGroupName --location $location
Set the variables:
# PowerShell
$templateFile="azuredeploy.json"
$storageName="st888999arm"
$storageSku="Standard_GRS"
$storageKind="StorageV2"
$vmSize="Standard_A2_v2"
# Azure CLI
templateFile="azuredeploy.json"
storageName="st888999arm"
storageSku="Standard_GRS"
storageKind="StorageV2"
vmSize="Standard_A2_v2"
Trigger the deployment:
# PowerShell
New-AzResourceGroupDeployment `
-Name DeployLocalTemplate `
-ResourceGroupName $resourceGroupName `
-TemplateFile $templateFile `
-storageName $storageName `
-storageSku $storageSku `
-storageKind $storageKind `
-vmSize $vmSize `
-verbose
# Azure CLI
az deployment group create \
--name DeployLocalTemplate \
--resource-group $resourceGroupName \
--template-file $templateFile \
--parameters \
storageName=$storageName \
storageSku=$storageSku \
storageKind=$storageKind \
vmSize=$vmSize \
--verbose
Enter the keyvault
directory:
cd keyvault
Directly copied/implemented from the documentation tutorial.
az group create --name ExampleGroup --location eastus2
az keyvault create \
--name kvarmtemplate999 \
--resource-group ExampleGroup \
--location centralus \
--enabled-for-template-deployment true
az keyvault secret set --vault-name kvarmtemplate999 --name "ExamplePassword" --value "hVFkk965BuUv"
Create the static-parameters.json
file from the sample:
# Set the variables manually
cp static-parameters-sample.json static-parameters.json
To deploy it with STATIC
id:
ℹ️ The Key Vault resource ID is statically defined in the static-parameters.json` file.
az deployment group create \
--resource-group ExampleGroup \
--template-file static-resources.json \
--parameters static-parameters.json
Create the dynamic-parameters.json
file from the sample:
# Set the variables manually
cp dynamic-parameters-sample.json dynamic-parameters.json
To deploy it with DYNAMIC
id:
az deployment group create \
--resource-group ExampleGroup \
--template-file dynamic-resources.json \
--parameters dynamic-parameters.json