Skip to content

The library Module usage

CARMLPipelinePrincipal edited this page Mar 11, 2022 · 11 revisions

This section provides a guideline on how to use the CARML Bicep modules.


Navigation


Deploy template

This section shows you how to deploy a Bicep template.

Deploy local template

This sub-section gives you an example on how to deploy a template from your local drive.

Local: PowerShell

This example targets a resource group level template.

New-AzResourceGroup -Name 'ExampleGroup' -Location "Central US"

$inputObject = @{
 DeploymentName    = 'ExampleDeployment'
 ResourceGroupName = 'ExampleGroup'
 TemplateFile      = "$home\ResourceModules\arm\Microsoft.KeyVault\vault\deploy.bicep"
}
New-AzResourceGroupDeployment @inputObject

Local: Azure CLI

This example targets a resource group level template.

az group create --name 'ExampleGroup' --location "Central US"
$inputObject = @(
    '--name',           'ExampleDeployment',
    '--resource-group', 'ExampleGroup',
    '--template-file',  "$home\ResourceModules\arm\Microsoft.KeyVault\vault\deploy.bicep",
    '--parameters',     'storageAccountType=Standard_GRS',
)
az deployment group create @inputObject

Deploy remote template

This section gives you an example on how to deploy a template that is stored at a publicly available remote location.

Remote: PowerShell

New-AzResourceGroup -Name 'ExampleGroup' -Location "Central US"

$inputObject = @{
 DeploymentName    = 'ExampleDeployment'
 ResourceGroupName = 'ExampleGroup'
 TemplateUri       = 'https://raw.githubusercontent.com/Azure/ResourceModules/main/arm/Microsoft.KeyVault/vaults/deploy.bicep'
}
New-AzResourceGroupDeployment @inputObject

Remote: Azure CLI

az group create --name 'ExampleGroup' --location "Central US"

$inputObject = @(
    '--name',           'ExampleDeployment',
    '--resource-group', 'ExampleGroup',
    '--template-uri',   'https://raw.githubusercontent.com/Azure/ResourceModules/main/arm/Microsoft.KeyVault/vaults/deploy.bicep',
    '--parameters',     'storageAccountType=Standard_GRS',
)
az deployment group create @inputObject

Orchestrate deployment

If you're interested on how to build a solution from the modules, please refer to the corresponding 'Solution creation' section.

Clone this wiki locally