【发布时间】:2020-03-10 19:18:47
【问题描述】:
我想以编程方式将用户添加到我的 Azure DevOps 服务组织,但他们不会收到通知。我已经开始使用User Entitlement Rest API 编写如下脚本,但用户仍会收到通知:
$method = 'POST'
$devopsuri = "https://vsaex.dev.azure.com/<Devops org name>/_apis/userentitlements?api-version=5.1-preview.1"
$pat = "<pat>"
$encodedPat = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$pat"))
$header = @ {
Authorization = "Basic $encodedPat"
}
$body = @ {
"accessLevel" = @ {
"accountLicenseType" = "stakeholder"
}
"user" = @ {
"principalName" = "<UPN>"
"subjectKind" = "user"
}
} | ConvertTo - Json - Depth 5
$result = Invoke - RestMethod - Uri $devopsuri - Method $method - Headers $header - Body $body - UseBasicParsing - ContentType 'application/json'
https://stackoverflow.com/questions/ask#
【问题讨论】:
标签: rest azure-devops azure-devops-rest-api