// EasyLife 365 setup template. Use case: identity/credential-renewal-secret (a renewed client secret). Version: v1. // Source: https://docs.easylife365.cloud/downloads/identity/credential-renewal-secret/v1/template.bicep // template.json next to it is built from this file with `az bicep build`. // // Creates a key vault that uses Azure role-based access control, and a secret with a random value, in the resource group // you deploy to. It gives no access: run grant.ps1 or grant.sh afterwards, which assigns "Key Vault Secrets Officer" to // the EasyLife 365 app on the secret. // // Deploy it once, for a new vault. Deploying it again writes a new random value into the secret, over the credential that // EasyLife 365 renewed, and sets the vault's settings back to the ones below, including role-based access control on a // vault that uses access policies. For an existing vault or secret, run the scripts instead: they stop on a vault with // access policies and keep an existing secret as it is. metadata description = 'EasyLife 365, identity/credential-renewal-secret v1: a key vault with Azure role-based access control and a secret. For a new vault only. Give access with the grant script afterwards.' @description('The key vault: 3 to 24 letters, digits and hyphens, starting with a letter, ending with a letter or digit, with no two hyphens in a row. Unique in Azure.') @minLength(3) @maxLength(24) param vaultName string @description('The secret: 1 to 127 letters, digits and hyphens.') @minLength(1) @maxLength(127) param secretName string @description('The Azure region of the key vault. Default: the region of the resource group.') param region string = resourceGroup().location @description('The first value of the secret. Leave the default: a random value that nobody sees. EasyLife 365 replaces it when it renews the credential.') @secure() param secretValue string = newGuid() resource vault 'Microsoft.KeyVault/vaults@2023-07-01' = { name: vaultName location: region properties: { tenantId: subscription().tenantId sku: { family: 'A' name: 'standard' } enableRbacAuthorization: true enableSoftDelete: true softDeleteRetentionInDays: 90 accessPolicies: [] } } resource secret 'Microsoft.KeyVault/vaults/secrets@2023-07-01' = { parent: vault name: secretName properties: { value: secretValue } } output secretResourceId string = secret.id