Skip to content

Get ms alias from github identity#2582

Closed
sima-zhu wants to merge 3 commits intoAzure:mainfrom
sima-zhu:msNameResovler
Closed

Get ms alias from github identity#2582
sima-zhu wants to merge 3 commits intoAzure:mainfrom
sima-zhu:msNameResovler

Conversation

@sima-zhu
Copy link
Copy Markdown
Contributor

Summary

The PR is using opensource rest API call to get ms alias from github identity.

Expect returns:

  1. 200 status.
    Return ms alias directly when call the scripts.
  2. error response.
    Print the API call error response and exit 1.

Testing locally

@azure-sdk
Copy link
Copy Markdown
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Copy Markdown
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Copy Markdown
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

[string]$ContentType = "application/json",

[Parameter(Mandatory = $false)]
[hashtable]$AdditionalHeaders
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we we have a need to pass extra headers?

[string]$ApiVersion = "2019-10-01",

[Parameter(Mandatory = $false)]
[string]$ContentType = "application/json",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to pass in the apiversion or contenttype as parameters?

@@ -0,0 +1,64 @@
<#
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets name this something like:
Get-AADIdentityFromGithubUser

[string]$AadToken,

[Parameter(Mandatory = $true)]
[string]$GithubName,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[string]$GithubName,
[string]$GithubUser,

[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $true)]
[string]$AadToken,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[string]$AadToken,
[string]$opsAuthToken,


try {
$headers = Load-RequestHeaders
Write-Host "Fetching ms alias for github identity: $GithubName."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Write-Host "Fetching ms alias for github identity: $GithubName."
Write-Host "Fetching aad identity for github user: $GithubName."

return $resp.aad.alias
}

LogError "Failed to retrieve the ms alias from given github identity: $GithubName."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LogError "Failed to retrieve the ms alias from given github identity: $GithubName."
LogError "Failed to retrieve the aad identity from given github user: $GithubName."

Should we exit 1 here as well, or is what is the expected way to handle the errors from this script?

@sima-zhu
Copy link
Copy Markdown
Contributor Author

Combined this PR with #2581
Closed this one.

@sima-zhu sima-zhu closed this Jan 21, 2022
@sima-zhu sima-zhu deleted the msNameResovler branch January 21, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants