Skip to content

Instantly share code, notes, and snippets.

View rahulpnath's full-sized avatar
🏠
Working from home

Rahul Nath rahulpnath

🏠
Working from home
View GitHub Profile
@davidfowl
davidfowl / Examples
Created May 21, 2011 08:19
Powershell function that recursively walks all project items within a project and lets you execute an action on each one
# Print all project items
Recurse-Project -Action {param($item) "`"$($item.ProjectItem.Name)`" is a $($item.Type)" }
# Function to format all documents based on https://gist.github.com/984353
function Format-Document {
param(
[parameter(ValueFromPipelineByPropertyName = $true)]
[string[]]$ProjectName
)
Process {
#this automates the steps found here: http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore
#yes, you could code golf this to about 6 characters if you wanted to
$find= @'
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
'@
foreach ($f in Get-ChildItem -Recurse -Path ".\" -Filter *.csproj | sort-object)
{
$text = Get-Content $f.FullName -Raw
@jackawatts
jackawatts / Add an Azure Resource Manager service connection.md
Last active April 1, 2020 10:35
Adding an Azure Resource Manager Service Connection in AzureDevOps

Taken from: https://blogs.msdn.microsoft.com/mihansen/2018/03/31/granular-vststfs-deployment-privileges-using-service-principals/

AzureDevOpsAR is simply the name of the app registration AzureDevOps will be associated with, don't like the name? Simply change the references below.

  1. Create an App Registration to act as a Service Principal:
    1. Log in to portal.azure.com
    2. Azure Active Directory => App Registrations => New Application Registration
    3. Name: AzureDevOpsAR, Type: Web app/API, Url: http://azuredevopsar (Url isn't important as it won't be used)
    4. Copy the Application ID as this will be the Service principal client ID
  2. Settings => Keys => Add
@csuzw
csuzw / index.js
Created November 7, 2019 10:49
Azure AD Single Sign On with Cypress
// This goes in cypress/plugins/index.js
const AzureAdSingleSignOn = require('./azure-ad-sso/plugin').AzureAdSingleSignOn
module.exports = (on, config) => {
on('task', {AzureAdSingleSignOn:AzureAdSingleSignOn})
}