简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM