зеркало из
1
0
Форкнуть 0

Convert live test clean-up to use WIF for open source api access (#35676)

Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
This commit is contained in:
Azure SDK Bot 2024-05-16 16:43:08 -07:00 коммит произвёл GitHub
Родитель d7c196f0a0
Коммит f92b18dbe7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -17,9 +17,9 @@ function Generate-AadToken ($TenantId, $ClientId, $ClientSecret)
return $resp.access_token
}
function GetAllGithubUsers ([string]$TenantId, [string]$ClientId, [string]$ClientSecret)
function GetAllGithubUsers ([string]$TenantId, [string]$ClientId, [string]$ClientSecret, [string]$Token)
{
# API documentation (out of date): https://github.com/microsoft/opensource-management-portal/blob/main/docs/api.md
# API documentation: https://github.com/1ES-microsoft/opensource-management-portal/blob/trunk/docs/microsoft.api.md
$OpensourceAPIBaseURI = "https://repos.opensource.microsoft.com/api/people/links"
$Headers = @{
@ -28,8 +28,10 @@ function GetAllGithubUsers ([string]$TenantId, [string]$ClientId, [string]$Clien
}
try {
$opsAuthToken = Generate-AadToken -TenantId $TenantId -ClientId $ClientId -ClientSecret $ClientSecret
$Headers["Authorization"] = "Bearer $opsAuthToken"
if (!$Token) {
$Token = Generate-AadToken -TenantId $TenantId -ClientId $ClientId -ClientSecret $ClientSecret
}
$Headers["Authorization"] = "Bearer $Token"
Write-Host "Fetching all github alias links"
$resp = Invoke-RestMethod $OpensourceAPIBaseURI -Method 'GET' -Headers $Headers -MaximumRetryCount 3
} catch {