Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active September 3, 2020 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/f3605100c5bfe7f7c7bd32f2d5fd1eb2 to your computer and use it in GitHub Desktop.
Save justinyoo/f3605100c5bfe7f7c7bd32f2d5fd1eb2 to your computer and use it in GitHub Desktop.
Bicep Sneak Peek
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"functions": {},
"variables": {},
"resources": [],
"outputs": {}
}
param myParameter string {
metadata: {
description: 'Name of Virtual Machine'
},
secure: true
allowed: [
'abc'
'def'
]
default: abc
}
// Resource name
param name string
// Resource suffix
param suffix string
param location string = resourceGroup().location
param locationCode string
param virtualMachineAdminUsername string
param virtualMachineAdminPassword string {
secure: true
}
param virtualMachineSize string {
allowed: [
'Standard_D2s_v3'
'Standard_D4s_v3'
'Standard_D8s_v3'
]
default: 'Standard_D8s_v3'
}
var metadata = {
longName: '{0}-${name}-${locationCode}${coalesce(suffix, '') == '' ? '': concat('-', suffix)}'
shortName: '{0}${replace(name, '-', '')}${locationCode}${coalesce(suffix, '') == '' ? '' : suffix}'
}
var storageAccount = {
name: replace(metadata.shortName, '{0}', 'st')
location: location
}
resource st 'Microsoft.Storage/storageAccounts@2017-10-01' = {
name: storageAccount.name
location: storageAccount.location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
resource vm 'Microsoft.Compute/virtualMachines@2018-10-01' = {
name = resourceName
location = resourceLocation
...
properties: {
...
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
storageUri: st.properties.primaryEndpoints.blob
}
}
}
}
$resourceType = @{ Label = "Resource Type"; Expression = { $_.ResourceTypes[0].ResourceTypeName } }
$apiVersion = @{ Label = "API Version"; Expression = { $_.ResourceTypes[0].ApiVersions[0] } }
Get-AzResourceProvider `
-ProviderNamespace <NAMESPACE> `
-Location <LOCATION> | `
Select-Object $resourceType, $apiVersion | `
Sort-Object -Property "Resource Type" | `
Where-Object { $_."Resource Type" -eq "<RESOURCE TYPE>" }
bicep build ./azuredeploy.bicep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment