Skip to content

Instantly share code, notes, and snippets.

Learning && Growing

Deepak Singh Dhami DexterPOSH

Learning && Growing
View GitHub Profile
View MyPlatform_crd.yaml
kind: CustomResourceDefinition
# name must match the spec fields below, and be in the form: <plural>.<group>
# group name to use for REST API: /apis/<group>/<version>
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
View CreateAzDOEnv_Error.ps1
$url = ''
$cred = Get-Credential -UserName 'vsts' -Message 'Enter AzDO Personal Access Token with privs to create env'
$encodedValue = [Convert]::ToBase64String(
("{0}:{1}" -f '', $cred.GetNetworkCredential().Password)
$body = @{
name = 'test-pwsh-env';
DexterPOSH / CreateAzDOEnv.ps1
Last active Apr 13, 2020
Gist showing Pwsh Code snippet to create environments.
View CreateAzDOEnv.ps1
$url = ''
$cred = Get-Credential -UserName 'vsts' -Message 'Enter AzDO Personal Access Token with privs to create env'
$encodedValue = [Convert]::ToBase64String(
("{0}:{1}" -f '', $cred.GetNetworkCredential().Password)
$body = @{
name = 'test-pwsh-env';
View creaAzDOenvError.json
"$id": "1",
"innerException": null,
"message": "No api-version was supplied for the \"POST\" request. The version must be supplied either as part of the Accept header (e.g. \"application/json; api-version=1.0\") or as a query parameter (e.g. \"?api-version=1.0\").",
"typeName": "Microsoft.VisualStudio.Services.WebApi.VssVersionNotSpecifiedException, Microsoft.VisualStudio.Services.WebApi",
"typeKey": "VssVersionNotSpecifiedException",
"errorCode": 0,
"eventId": 3000
DexterPOSH /
Created Feb 25, 2020
Test content file generated from Hugo CLI
title date draft
1 Hello World
2020-02-25 19:23:53 +0530


Customary "Hello World" program.

DexterPOSH / FetchAssignedPr.ps1
Last active Oct 15, 2019
Code snippet to fetch PRs where a user is assigned as a reviewer
View FetchAssignedPr.ps1
# fetch all the release pipelines metadata for the project
$ProjectName = 'BitPro.AzDeploy'
# Need the UserEmail as this is the unique name
$UserEmail = ''
# generate a list of User & Groups names to search for in the PR
$IDs = New-Object -TypeName System.Collections.ArrayList
$UserObject = az devops user show --user $UserEmail | ConvertFrom-Json
DexterPOSH / azDevopsReleaseTaskAudit.ps1
Last active Oct 10, 2019
This PowerShell script lists out how to use Az CLI's DevOps extension to walk through the release definitions in a project and check for a specific taskId.
View azDevopsReleaseTaskAudit.ps1
# Set the PAT as an Environment variable, put this in your profile.
# I only use the CLI for read operations so make sure you grant the PAT only that access
$env:AZURE_DEVOPS_EXT_PAT = "<Insert PAT Token here>"
# configure the defaults for the Az DevOps extension for Az CLI to use
az devops configure --defaults organization= project=Test.Project
# see the configured defaults
az devops configure --list
View Get-SCCMDeviceInfo.ps1
function Get-SCCMDeviceInfo
# Specify the Package IDs which need to be removed from the DP
DexterPOSH / auth.go
Created May 18, 2019
getAuthorizer() method for settings struct
View auth.go
func (settings settings) getAuthorizer() (autorest.Authorizer, error) {
//1.Client Credentials
if settings.clientSecret != "" {
config := NewClientCredentialsConfig(settings.clientID, settings.clientSecret, settings.tenantID)
config.AADEndpoint = settings.environment.ActiveDirectoryEndpoint
config.Resource = settings.resource
return config.Authorizer()
//2. Client Certificate