Code Monkey home page Code Monkey logo

azure-arm-templates's Introduction

ARM Templates

Virtual Machine

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.

Create the Resource Group

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

Deploy the Template

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

Key Vault

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"

Static

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

Dynamic

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

azure-arm-templates's People

Contributors

epomatti avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.