Skip to content

Instantly share code, notes, and snippets.

View thepaulmacca's full-sized avatar
💻

Paul McDonald thepaulmacca

💻
View GitHub Profile
@thepaulmacca
thepaulmacca / keyVaultSecretStorageAccountConnectionString.bicep
Last active April 29, 2024 14:16
Bicep - Key Vault Secret - Storage Account Connection String
resource keyVault 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: last(split(keyVaultId, '/'))
resource storageSecret 'secrets' = {
name: 'StorageAccount-ConnectionString'
properties: {
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccountName};AccountKey=${listKeys(storageAccount.id, storageAccount.apiVersion).keys[1].value}'
}
}
}
@thepaulmacca
thepaulmacca / keyVault.bicep
Last active October 12, 2021 20:28
Bicep - Key Vault Resource Definition
/*
By default this is being deployed without private link configured but
if you want to enable it, just uncomment the resources below
*/
param location string
param appName string
param environmentName string
param logAnalyticsWorkspaceId string
// param vnetName string
// param vnetId string
@thepaulmacca
thepaulmacca / pr-comment-build-artifact.yml
Last active January 27, 2022 11:02
Azure Pipelines - PR comment with download link to latest build artifact
- task: PowerShell@2
displayName: 'Get Latest Build ID'
inputs:
targetType: 'inline'
script: |
$definitionName = "$(Build.DefinitionName)"
$url="$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_apis/build/definitions?name=$definitionName&includeLatestBuilds=true&api-version=6.0"
$result = Invoke-RestMethod -Uri $url -Headers @{authorization = "Bearer $(System.AccessToken)"} -Method Get
$buildId = $result.value[0].latestBuild.id