Saturday, April 27, 2024
HomePowershellMinicurso Azure Bicep – Aula 3

Minicurso Azure Bicep – Aula 3


Olá Pessoal,

Nessa aula vamos aprender a declarar um recurso no Bicep com parametros e iniciar o deploy desse template through powershell com o Modulo Az. Também utilizamos um modulo chamado Bicep para gerar o arquivo de parametros do nosso template.

Para instalar os modulos make the most of o seguinte comando:

Set up-Module -Identify 'Az', 'Bicep' -Scope CurrentUser -Verbose

 

Video:

Comando para deployment:
$AzResourceGroupDeployment= @{
    Identify = 'BicepTest' 
    ResourceGroupName = 'BicepLab' 
    Mode = 'Incremental' 
    TemplateFile = '.Aula3.bicep' 
    TemplateParameterFile = '.Aula3.parameters.json'
}
New-AzResourceGroupDeployment @AzResourceGroupDeployment
Template:
@description('Nome da Storage Account')
@maxLength(20)
param identify string

@description('Localizacao da Storage Account')
@allowed([
  'canadacentral'
  'canadaeast'
])
param location string

@description('SKU da Storage Account')
@allowed([
  'Premium_LRS'
  'Standard_LRS'
])
param skuname string

useful resource stg_Account 'Microsoft.Storage/[email protected]' = {
  identify: identify
  location: location
  type: 'StorageV2'
  sku:{
    identify: skuname
  }
  properties:{
    accessTier: 'Sizzling'
    minimumTlsVersion: 'TLS1_2'
  }
}

output id string = stg_Account.id
output endpoints string = stg_Account.properties.primaryEndpoints.blob
Parâmetros:
{
  "$schema": "https://schema.administration.azure.com/schemas/2019-04-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "identify": {
      "worth": "guidobicep3"
    },
    "location": {
      "worth": "canadacentral"
    },
    "skuname": {
      "worth": "Standard_LRS"
    }
  }
}

 

Dúvidas? Sugestões? Comente!

Até a próxima!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments