Skip to content

Conversation

@jiasli
Copy link
Member

@jiasli jiasli commented May 19, 2020

Description
Sync changes from release to identity.

There are several conflicts from src/azure-cli-core/azure/cli/core/_profile.py introduced by @arrownj in #12999.

⚠ DO NOT SQUASH MERGE

Jianhui Harold and others added 30 commits April 20, 2020 12:40
There is no need to sleep before parsing the response from the SCM server.  Unless the status needs to continue to loop, this should return instantly.
…le (#13062)

* Adding private DNS zone import export feature

* adding live tests

* Incorporating review comments

* style issue

* Fixing local test

* Encorporating review comment and adding test
* test LA cluster

* Support LA cluster CMK feature

* fix test

* recording test for cluster CRUD

* fix erros in other command modules due to version upgrade for log analytics

* fix tests in other command modules due to version upgrade for log analytics

* fix tests in other command modules due to version upgrade for log analytics from CI full test

* fix test
…h feature (#12999)

* {Core} support get msal accesstoken with adal refresh token for vm ssh feature

* add License header for _msal.py

* use hashlib instead of build-in hash function

* refactor get_msal_token function

* delete unused code

* add query parameter

* add test for get_msal_token
* [Compute] az vm availability-set list: Support showing VM list

* test

* test, 2019-03-01
…eview API version (#12240)

* Upgrade openshift models to 2019-10-27-preview API version

* Fix private-cluster parameter

* Fix management_subnet_cidr property

* Fix refresh cluster handling

* fix lint

* remove manually written history

* remove short summary from _help.py as per code review suggestion

* Update OSA API version

Co-authored-by: Olga Mirensky <[email protected]>
Co-authored-by: Feng Zhou <[email protected]>
* [Compute] az vm list-skus: Fix display problem of table format

* test
… BYOS features (#13187)

* finish code

recording

finish tests

* address comments and rerun tests

* refine logic

* address comments

* fix style
…t-If for ARM template deployment (#12942)

* Create formatters for What-If operation result.

* Add change type legend formatter.

* Implement deployment what-if cmdlets.

* Add senarios tests for deployment what-if cmdlets.

* Add What-If confirmation switches.

* Write help for what-if commands.

* Fix an error due to rebasing.

* Cleanup code.

* Handle no_color mode.

* Enable VT mode before rendering What-If results.

* Add license headers.

* Fix linter errors.

* Fix help docs.

* Add no_prompt paramter to what-if commands.

* Try to fix pylint error in CI pipeline.

* Fix pylint error round 2.

* Fix the pylint error caused by the first fixing pylint error attempt...

* Create an alias -r for --what-if-result-format.

* Fix help doc.

* Use plural verbs in help messages.

* Create an alias -c for --confirm-with-what-if.

* Remove aux_subscriptions from RG-level what-if command.

* Restore handle_extended_json_format.

* Add min_api constraints for What-If commands.

* Also catch exception for vt mode enabling.

* Fix a regression.

* Refactor What-If argument types.

* Use get_models to import models.

* Fix a test failure for old API versions.

* Using get_models in formatter tests.

* Add tests for prompt with confirm_with_what_if.

* Fix a test name.

* Fix a linter error.
Jianhui Harold and others added 3 commits May 16, 2020 15:47
)

* change title to alert how to pass array parameters

* add a dedicated section

* fix bug

* Update doc/use_cli_effectively.md

Co-authored-by: Jiashuo Li <[email protected]>

* Update doc/use_cli_effectively.md

Co-authored-by: Jiashuo Li <[email protected]>

* add JSON example

* add them in resource/_help.py

* typo

Co-authored-by: Jiashuo Li <[email protected]>
* update azure-cli version to 2.6.0

* Apply suggestions from code review

Co-authored-by: Yunge Zhu <[email protected]>
Co-authored-by: Feng Zhou <[email protected]>
Co-authored-by: Xiaojian Xu <[email protected]>

Co-authored-by: Bin Ma <[email protected]>
Co-authored-by: Yunge Zhu <[email protected]>
Co-authored-by: Feng Zhou <[email protected]>
Co-authored-by: Xiaojian Xu <[email protected]>
Comment on lines +1023 to +1034
def retrieve_msal_token(self, tenant, scopes, data, refresh_token):
"""
This is added only for vmssh feature.
It is a temporary solution and will deprecate after MSAL adopted completely.
"""
from azure.cli.core._msal import AdalRefreshTokenBasedClientApplication
tenant = tenant or 'organizations'
authority = self._ctx.cloud.endpoints.active_directory + '/' + tenant
app = AdalRefreshTokenBasedClientApplication(_CLIENT_ID, authority=authority)
result = app.acquire_token_silent(scopes, None, data=data, refresh_token=refresh_token)

return result["access_token"]
Copy link
Member Author

Choose a reason for hiding this comment

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

Identity needs to support this method as CredsCache is removed.

Comment on lines +596 to +606
def get_msal_token(self, scopes, data):
"""
This is added only for vmssh feature.
It is a temporary solution and will deprecate after MSAL adopted completely.
"""
account = self.get_subscription()
username = account[_USER_ENTITY][_USER_NAME]
tenant = account[_TENANT_ID] or 'common'
_, refresh_token, _, _ = self.get_refresh_token()
certificate = self._creds_cache.retrieve_msal_token(tenant, scopes, data, refresh_token)
return username, certificate
Copy link
Member Author

Choose a reason for hiding this comment

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

get_msal_token should use Identity instead of CredsCache.

Comment on lines +1230 to +1234
except UnicodeDecodeError:
logger.warning("Please make sure there is no international (Unicode) character in the computer name "
r"or C:\Windows\System32\drivers\etc\hosts file's 127.0.0.1 entries. "
"For more details, please see https://github.com/Azure/azure-cli/issues/12957")
break
Copy link
Member Author

Choose a reason for hiding this comment

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

This should be caught in Identity.

@yonzhan yonzhan added this to the S170 milestone May 20, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented May 20, 2020

Identity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.