This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -version 5.0 | |
Function ConvertTo-Markdown { | |
<# | |
.Synopsis | |
Convert pipeline output to a markdown document. | |
.Description | |
This command is designed to accept pipelined output and create a markdown document. The pipeline output will formatted as a text block. You can optionally define a title, content to appear before the output and content to appear after the output. | |
The command does not create a text file. You need to pipe results from this command to a cmdlet like Out-File or Set-Content. See examples. | |
.Parameter Title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
param( | |
[ValidateNotNullOrEmpty()] | |
[string]$repo, | |
[ValidateNotNullOrEmpty()] | |
[string]$token, | |
[ValidateNotNullOrEmpty()] | |
[int]$PRfrom, | |
[ValidateNotNullOrEmpty()] | |
[int]$PRto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "null_resource" "deploy_workspace_settings" { | |
provisioner "local-exec" { | |
command = <<EOT | |
Import-Module ${path.module}/tf_azure_api_call.psm1 | |
New-WorkspaceSetting ` | |
-ClientId "${var.ARM_CLIENT_ID}" ` | |
-ClientSecret "${var.ARM_CLIENT_SECRET}" ` | |
-SubscriptionId "${var.ARM_SUBSCRIPTION_ID}" ` | |
-TenantId "${var.ARM_TENANT_ID}" ` | |
-WorkspaceId "${var.workspace_id}" ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Dynamically creates Azure DevOps "Environments" with security permissions, approvers and branch control. | |
.DESCRIPTION | |
The variable "$envList" is an object that sets the high level management groups and their settings which | |
will be used to create each environment; | |
approval = enable approval checks | |
branch_control = limit deployments only to ref/heads/main | |
env_group = which of the three environment groups the management group belows (nonprod, preprod, prod) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
An easy text-based view of how quickly PRs are being approved. | |
.DESCRIPTION | |
This script was born out of the need to help a client understand how quickly we are progressing with PR approvals. | |
It's a handy way to view how a particular repo, or all the repos within an Azure DevOps project is progressing for | |
PR approvals. | |
It will find the longest running PR and set it's text-based graphical view at 100% noted with the "-" for each 1%. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PSVersionTable | |
$ErrorActionPreference = "Stop" | |
$sourceBranch = $(${Env:SYSTEM_PULLREQUEST_SOURCEBRANCH} -split "refs/heads/")[-1] | |
# We need to checkout the branch in order to compare the differences in files changed from develop branch | |
Set-Location -Path "${Env:SYSTEM_DEFAULTWORKINGDIRECTORY}/${Env:BUILD_REPOSITORY_NAME}" | |
git checkout $sourceBranch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PSVersionTable | |
$ErrorActionPreference = "Stop" | |
$branch = $Env:BUILD_SOURCEBRANCHNAME | |
$headers = @{ | |
"Authorization" = "Bearer ${Env:SYSTEM_ACCESSTOKEN}" | |
"Content-Type" = "application/json" | |
} | |