kitten
kitten

Reputation: 31

Azure Devops remove specific user from specific organization using Powershell

Example, I want to Offboard Tiger from Azure Develops Organization BigZoo (Tiger has 3 Azure organization, BigZoo, SmallZoo, middleZoo--I only want to remove tiger from BigZoo)

Use this Azure CLI in the Azure Cloudshell Powershell will be working

az devops user remove --user tiger
                      [--org BigZoo]
                      [--yes]

But it does not work in Azure function-->Azure function use PowerShell environment--> CloudPowerShell can read AzureCLi but Powershell In AzureFunction cannot read anything related with Az

So, if I only want use powershell without any help from Azure CLI, there are some module but all imported module is remove user from all Organizations--> Not remove user from specific organization

Any suggestion? Remove user from specific AzureDevops Organization. Using API seems too complex . Any good idea? Thanks

Upvotes: 0

Views: 672

Answers (1)

BrettMiller
BrettMiller

Reputation: 1046

I've not tried this but there is the VSTeam powershell module in the PowerShell gallery which wraps the Azure Devops API.

This has a function called: Remove-VSTeamUserEntitlement

Docs here: https://methodsandpractices.github.io/vsteam-docs/docs/modules/vsteam/commands/Remove-VSTeamUserEntitlement

Module here: https://www.powershellgallery.com/packages/VSTeam/

Add the module to the Requirements.psd1 file of your azure functions project and you should be able to utilise it.

Upvotes: 2

Related Questions