Azure DevOps PowerShell Module - Part 1

PowerShell01/20/2019

If you are like me - at least in terms of lazyness - you automate the stuff that you face more than once. Recently, I came accross the reoccuring task of creating Azure DevOps projects with several teams over and over again.

This is the first post of many other posts to come and I would really appreciate some feedback!

Since I'm a PowerShell guy, I started writing a little Module for this and the first version is now online!

You can get it directly from the PowerShell Gallery:

Install

Install-Module -Name AzDOps

The new Azure PowerShell module uses the prefix 'Az' (Microsoft Docs link) for the cmdlets - the cmdlets for Azure DevOps use 'AzDo'.

Connect-AzDo
Disconnect-AzDo
Get-AzDoGitRepository
Get-AzDoProcesses
Get-AzDoProject
Get-AzDoProjectHistory
Get-AzDoProjectProperties
Get-AzDoSecurityNamespace
Get-AzDoTeam
New-AzDoGitRepository
New-AzDoProject
New-AzDoTeam
Remove-AzDoGitRepository
Remove-AzDoProject
Remove-AzDoTeam
Disclaimer: The module does by far not have the final scope yet. It currently only covers very basic functionality but it will grow over the months to come.

Connect

To connect to your Azure DevOps organization, you have to create a personal access token first. Open this link and follow the instructions. Afterwards, you can save both, the token as well as the name of your Azure DevOps organization as a string to a variable - then you can connect:

$token = "token"
$organizationName = "orgName"

Connect-AzDo -PersonalAccessTokens $token -OrganizationName $organizationName

In the future, there will also be an interactive way to connect using Oauth2 - it's planned for the next releases. Right now, the connection is being established using basic authentication.

When you're connected, you can start using the cmdlets:

Get-AzDoProject
Get-AzDoTeam -ProjectId '<projectId>'
New-AzDoProject -Name 'ProjectOne'