Last active
September 3, 2020 03:41
-
-
Save justinyoo/f3605100c5bfe7f7c7bd32f2d5fd1eb2 to your computer and use it in GitHub Desktop.
Bicep Sneak Peek
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": {}, | |
"functions": {}, | |
"variables": {}, | |
"resources": [], | |
"outputs": {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param myParameter string { | |
metadata: { | |
description: 'Name of Virtual Machine' | |
}, | |
secure: true | |
allowed: [ | |
'abc' | |
'def' | |
] | |
default: abc | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Resource name | |
param name string | |
// Resource suffix | |
param suffix string | |
param location string = resourceGroup().location | |
param locationCode string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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>" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bicep build ./azuredeploy.bicep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment