Skip to content

Instantly share code, notes, and snippets.

View thepaulmacca's full-sized avatar
💻

Paul McDonald thepaulmacca

💻
View GitHub Profile
@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
@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 / 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 / keyVaultSecretUserRoleAssignment.bicep
Last active September 24, 2024 17:53
Bicep - Key Vault Secret User RBAC Role Assignment - App Service Identity
resource keyVault 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: keyVaultName
}
@description('This is the built-in Key Vault Secret User role. See https://docs.microsoft.com/azure/role-based-access-control/built-in-roles#key-vault-secrets-user')
resource keyVaultSecretUserRoleRoleDefinition 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {
scope: subscription()
name: '4633458b-17de-408a-b874-0445c86b69e6'
}
@thepaulmacca
thepaulmacca / azure-pipelines.yml
Last active January 4, 2022 14:32
Azure Pipelines - Bicep Deployment Pipeline Template (GitHub repo)
trigger:
branches:
include:
- main
resources:
repositories:
- repository: templates
type: github
name: thepaulmacca/azure-pipelines-templates
@thepaulmacca
thepaulmacca / appService.bicep
Last active October 27, 2021 07:57
Bicep - App Service Deployment Example
@description('The Azure region into which the resources should be deployed')
param location string = resourceGroup().location
@description('The type of environment. This must be nonprod or prod')
@allowed([
'nonprod'
'prod'
])
param environmentType string
@thepaulmacca
thepaulmacca / pull_request_template.md
Created January 13, 2022 14:51
Pull Request Template

Fixes #

@thepaulmacca
thepaulmacca / automationAccountContributor.json
Created January 13, 2022 14:53
Azure RBAC Custom Role - Automation Account Contributor
{
"properties": {
"roleName": "Automation Account Contributor",
"description": "Allows access to manage Azure Automation and its resources",
"assignableScopes": [
"/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX"
],
"permissions": [
{
"actions": [
@thepaulmacca
thepaulmacca / Microsoft.PowerShell_profile.ps1
Last active February 14, 2025 11:50
PowerShell Profile
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
Import-Module posh-git
@thepaulmacca
thepaulmacca / ado-docs-wiki-sync.yaml
Last active July 5, 2022 10:39
Azure Pipelines - Sync Documentation with Azure DevOps Wiki Page
# requires the WIKI Updater Tasks extension https://marketplace.visualstudio.com/items?itemName=richardfennellBM.BM-VSTS-WIKIUpdater-Tasks
trigger:
branches:
include:
- main
paths:
include:
- docs/*