Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ def validate_principal(ns):
raise argparse.ArgumentError(
None, 'specify exactly one: --object-id, --spn, --upn')

attrs = ['object_id', 'spn', 'upn']
for attr in attrs:
if getattr(ns, attr):
setattr(ns, attr, getattr(ns, attr).strip('"'))
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.

for upn, is it safe to strip " ? what's the name convention? suggest only change object_id for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for upn, is it safe to strip " ? what's the name convention? suggest only change object_id for now.

Most of UPN names are email-like: https://docs.microsoft.com/en-us/azure/active-directory/hybrid/plan-connect-userprincipalname
As far as I know there is also a type of UPN for external users like this: bim_microsoft.com#EXT#@AzureSDKTeam.onmicrosoft.com

Both formats don't have leading or tailing quotes.
But in case that there are maybe some unknown formats may have quotes, I will keep the original format for UPN and SPN. Will investigate them again when we have new user ask.



def validate_resource_group_name(cmd, ns):
"""
Expand Down
Loading