Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK/CLI] Handle user name for non-msft tenant #1671

Merged
merged 3 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions src/promptflow/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
- Fix unaligned inputs & outputs or pandas exception during get details against run in Azure.
- Fix loose flow path validation for run schema.

### Improvements

- [SDK/CLI] For `pfazure flow create` used by non-msft tenant user, use user name instead of user object id in the remote flow folder path. (e.g. `Users/<user-name>/promptflow`).

## 1.3.0 (2023.12.27)

### Features Added
Expand Down
4 changes: 2 additions & 2 deletions src/promptflow/promptflow/azure/_utils/gerneral.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def is_arm_id(obj) -> bool:


def get_user_alias_from_credential(credential):
token = credential.get_token("https://storage.azure.com/.default").token
token = credential.get_token("https://management.azure.com/.default").token
decode_json = jwt.decode(token, options={"verify_signature": False, "verify_aud": False})
try:
email = decode_json["upn"]
email = decode_json.get("upn", decode_json.get("email", None))
return email.split("@")[0]
except Exception:
# use oid when failed to get upn, e.g. service principal
Expand Down
Loading