Skip to content

Instantly share code, notes, and snippets.

@bmoore-msft
bmoore-msft / New-KeyVaultForTemplateDeployment.ps1
Created February 22, 2016 21:40
Create an Azure KeyVault Enabled for Template Deployment (sh and ps)
#Requires -Module AzureRM.Profile
#Requires -Module AzureRM.KeyVault
#Login and Select the default subscription if needed
#Login-AzureRmAccount
#Select-AzureRmSubscription -SubscriptionName 'subscription name'
#Change the values below before running the script
$VaultName = 'myvault' #Globally Unique Name of the KeyVault
$VaultLocation = 'East US' #Location of the KeyVault
@bmoore-msft
bmoore-msft / Get-ProviderApiVersion.psm1
Last active January 14, 2021 16:09
Get the api versions and locations for a resource type published in the manifest
function api {
<#
.Synopsis
Get the api versions and locations for a resource type.
.Description
Lists all the available api versions and locations for a given resource type. Information is pulled from the /providers api
which returns the information in the manifest published to ARM.
.Notes
The resource parameter requires the format of Namespace/type, e.g. Microsoft.Storage/storageAccounts
> api Microsoft.Storage/storageAccounts
@bmoore-msft
bmoore-msft / gist:09c395015e9486c75ddb2f45dc5028b0
Created July 30, 2021 23:04
deploy a resource with an expression for the type property
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"type": {
"type": "string",
"defaultValue": "Microsoft.Network/publicIPAddresses"
}
},
"resources": [
@bmoore-msft
bmoore-msft / main.json
Last active August 31, 2021 17:32
ARM Template using MSI for custom script extension download
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.4.451.19169",
"templateHash": "16656980055364544710"
}
},
@bmoore-msft
bmoore-msft / Verify-DeploymentGuid.ps1
Last active March 22, 2022 19:20
Fetch the resources tagged in a pid-[GUID] deployment
Param(
[string][Parameter(Mandatory=$true)]$deploymentName, # the full name of the deployment, e.g. pid-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
[string][Parameter(Mandatory=$true)]$resourceGroupName
)
# Get the correlationId of the named deployment
$correlationId = (Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name "$deploymentName").correlationId
# Find all deployments with that correlationId
$deployments = Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName | Where-Object{$_.correlationId -eq $correlationId}
@bmoore-msft
bmoore-msft / createUiDefinition-existing-subnet.json
Created May 24, 2022 20:51
Sample createUiDefinition.json file that shows how to provide an experience to select an existing subnet
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{
"name": "vnetSelector",
"type": "Microsoft.Solutions.ResourceSelector",
"label": "Virtual Network",