Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active June 18, 2020 11:28
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save justinyoo/53a5c751808161187b69e35c10b3b481 to your computer and use it in GitHub Desktop.
Save justinyoo/53a5c751808161187b69e35c10b3b481 to your computer and use it in GitHub Desktop.
Writing ARM Templates in YAML
$schema: 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#'
contentVersion: 1.0.0.0
parameters:
logicAppName1:
type: string
metadata:
description: Name of the Logic App.
logicAppName2:
type: string
metadata:
description: Name of the Logic App.
variables:
logicApp:
name: "[concat(parameters('logicAppName1'), '-', parameters('logicAppName2'))]"
apiVersion: "[providers('Microsoft.Logic', 'workflows').apiVersions[0]]"
location: '[resourceGroup().location]'
tags:
author: Justin Yoo
profile: 'https://twitter.com/justinchronicle'
projectUrl: 'https://github.com/devkimchi/ARM-Templates-in-YAML'
repositoryUrl: 'https://github.com/devkimchi/ARM-Templates-in-YAML'
license: 'https://raw.githubusercontent.com/devkimchi/ARM-Templates-in-YAML/master/LICENSE'
resources:
- apiVersion: "[variables('logicApp').apiVersion]"
type: Microsoft.Logic/workflows
name: "[variables('logicApp').name]"
location: "[variables('logicApp').location]"
tags: "[variables('tags')]"
properties:
state: Enabled
parameters: {}
definition:
$schema: 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#'
contentVersion: 1.0.0.0
parameters: {}
triggers: {}
actions: {}
outputs: {}
outputs:
subscriptionId:
type: string
value: '[subscription().subscriptionId]'
resourceGroup:
type: string
value: '[resourceGroup().name]'
$directory = "$(Build.SourcesDirectory)"
$yarmpath = "$(System.DefaultWorkingDirectory)\yarm-cli\yarm.cmd"
$targetdir = "$(Build.SourcesDirectory)"
Get-ChildItem -Path $directory -Recurse -Include *.yaml | `
ForEach { & $yarmpath -i $_.FullName -o "$targetdir\$($_.Name)".Replace(".yaml", ".json") }
$script = Invoke-WebRequest https://raw.githubusercontent.com/TeamYARM/YARM-CLI/master/Download-Latest.ps1
$argList = "win-x64", "$(System.DefaultWorkingDirectory)\yarm-cli"
Invoke-Command -ScriptBlock ([scriptblock]::Create($script.Content)) -ArgumentList $argList
yarm -i azuredeploy.yaml -o azuredeploy.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment