Skip to content

Instantly share code, notes, and snippets.

View stefanstranger's full-sized avatar
💭
Developing code for our customers and just for fun!

Stefan Stranger stefanstranger

💭
Developing code for our customers and just for fun!
View GitHub Profile
@stefanstranger
stefanstranger / Create-WIKIDocumentation.ps1
Created April 12, 2020 10:02
Create Azure DevOps WIKI Documentation
<#
PowerShell script to create Azure DevOps WIKI Markdown Documentation
https://docs.microsoft.com/en-US/rest/api/azure/devops/wiki/pages/create%20or%20update?view=azure-devops-rest-5.0#examples
https://medium.com/digikare/create-automatic-release-notes-on-azuredevops-f235376ec533
Requirements:
- PSDocs PowerShell Module (Install-Module -Name PSDocs)
#>
@stefanstranger
stefanstranger / HelloWorldUD-Example.ps1
Last active October 3, 2020 11:32
Universal Dashboard Hello World Example
$MyDashboard = New-UDDashboard -Title "Hello World" -Content {
New-UDCard -Title "Hello World - Universal Dashboard"
}
Start-UDDashboard -Port 8585 -Dashboard $MyDashboard -Name 'HelloDashboard' -Wait
@stefanstranger
stefanstranger / choco.config
Last active November 11, 2020 19:43
Chocolatey configuration
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="7zip.install" version="19.0" />
<package id="ARMClient" version="1.8.0" />
<package id="autoruns" version="13.98.20200930" />
<package id="azure-cli" version="2.14.2" />
<package id="azure-functions-core-tools-3" version="3.0.2996" />
<package id="chezmoi" version="1.8.7" />
<package id="chocolatey" version="0.10.15" />
<package id="chocolatey-core.extension" version="1.3.5.1" />
@stefanstranger
stefanstranger / Validate-ACRName.ps1
Created November 21, 2020 11:54
Check Azure Container Registry Name
# Check if the name myRegistry can be used for a new Azure Registry Container.
# More info: https://docs.microsoft.com/en-us/rest/api/containerregistry/registries/checknameavailability
#region variables
$ACRName = 'myRegistry'
$ResourceType = 'Microsoft.ContainerRegistry/registries'
#endregion
#region Get AccessToken
@stefanstranger
stefanstranger / Get-YamlPipeline.ps1
Last active January 29, 2021 13:30
PowerShell script to retrieve Azure DevOps Yaml Pipelines
<#
PowerShell script to retrieve Azure DevOps Yaml Pipelines
Requires:
- PSDevOps PowerShell Module (Install-Module PSDevOps)
- powershell-yaml PowerShell Module (Install-Module powershell-yaml)
- Personal Access Token for Azure DevOps Organization and Project where you want to retrieve the Yaml Pipelines
Example: Return all Tasks within a job and steps.
$YamlPipelines | Select-Object -ExpandProperty Yaml |
Select-Object -ExpandProperty jobs |
We couldn’t find that file to show.
@stefanstranger
stefanstranger / test.ps1
Last active March 6, 2022 01:13
Testing dynamic where in PowerShell
$Test = [PSCustomObject] @{
FirstName = 'Stefan'
LastName = 'Stranger'
#"Difffrent parametr" = 'ok'
}
function Get-WhereObject {
[cmdletBinding()]
param(
[Parameter(Mandatory, Position = 0, ValueFromPipeline)][PSCustomObject] $Test
@stefanstranger
stefanstranger / parallel-pester-tests.ps1
Last active May 16, 2021 19:58
Run Pester Tests parallel
# Example code of running multiple Pester test in parallel and merging the result into one NUnitReport Test Report file
#region Run Pester Test scripts in parallel
$job = Get-ChildItem -Path "./tests" -Filter "Demo*"
| ForEach-Object -Parallel {
Invoke-Pester -Path $_ -PassThru
} -ThrottleLimit 10 -AsJob
$Results = ($job | Wait-Job | Receive-Job -Keep)
#endregion
@stefanstranger
stefanstranger / decompile-bicep-to-psarm.ps1
Last active April 21, 2021 14:34
Decompiling Bicep file to PSArm object
<#
Decompiling a bicep file to PSArm
Inspired on issue posted on PSArm Github repo.
https://github.com/PowerShell/PSArm/issues/154
#>
# Decompile ARM template to Bicep file
bicep decompile C:\Users\stefstr\Documents\Github\PSArm\examples\simple-test\template.json
@stefanstranger
stefanstranger / logic-jiraintegration-demo.json
Created December 22, 2022 15:15
Logic App Workflow - JIRA Integration
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For Each - SHA": {
"actions": {
"Condition_-_Status": {
"actions": {
"Compose - Current Item": {
"inputs": "@items('For Each - SHA')",