Skip to content

Conversation

@avanigupta
Copy link
Member

@avanigupta avanigupta commented Sep 15, 2020

Description

App Configuration supports AAD authentication and authorization for all data operations. Since we are now using the official Python SDK for AppConfiguration, we can easily support AAD auth in appconfig CLI module by utilizing the az login credentials.
This PR introduces two new arguments for users to authenticate using AAD credentials:

  • --auth-mode (login or key; default is key which preserves the current behavior)

  • --endpoint (AppConfiguration endpoint like https://storename.azconfig.io)

For any existing AppConfig commands, providing the --name and --connection-string parameters will use key (HMAC) auth for data operations (preserving current behavior). Instead of these two arguments, if users provide --auth-mode login and --endpoint parameters, AAD credentials will be used to connect to AzureAppConfigurationClient.

Testing Guide

  1. Create a new App Configuration with name "aadtestcli".
  2. Create a key-value with key "testKey" and any value.
  3. Create a new service principal and assign it "App Configuration Data Reader" role in your App Configuration. Wait for about 15 minutes for permissions to propagate.
  4. Login to CLI with the service principal credentials.

This read request should succeed:
az appconfig kv show --key testKey --auth-mode login --endpoint https://aadtestcli.azconfig.io

This write request should fail with 'Forbidden' error:
az appconfig kv lock --key testKey --auth-mode login --endpoint https://aadtestcli.azconfig.io

History Notes


This checklist is used to make sure that common guidelines for a pull request are followed.

@avanigupta avanigupta force-pushed the avanigupta/aadauthdataplane branch from eb01f76 to badda2f Compare September 16, 2020 03:44
@Azure Azure deleted a comment from yonzhan Sep 17, 2020
@yungezz
Copy link
Member

yungezz commented Sep 17, 2020

hi @bim-msft could you pls review the PR? thanks.

@avanigupta
Copy link
Member Author

Hi @recao, could you please help review this PR?

@avanigupta avanigupta force-pushed the avanigupta/aadauthdataplane branch from f0f435f to 5968768 Compare September 18, 2020 20:24
@bim-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@avanigupta avanigupta force-pushed the avanigupta/aadauthdataplane branch from 2df627d to b112dad Compare September 25, 2020 21:37
@avanigupta
Copy link
Member Author

Hi @bim-msft, @jiasli, can you please review this PR?

@yungezz
Copy link
Member

yungezz commented Sep 29, 2020

hi @fengzhou-msft could you pls help to review since @bim-msft is oof? thanks.

Copy link
Contributor

@shenmuxiaosen shenmuxiaosen left a comment

Choose a reason for hiding this comment

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

:shipit:

@fengzhou-msft fengzhou-msft added this to the S176 milestone Sep 30, 2020
@yonzhan yonzhan requested a review from jiasli September 30, 2020 10:22
@avanigupta
Copy link
Member Author

Hi @yonzhan , since Jiashuo is OOF, can someone else help review this PR?

@yonzhan
Copy link
Collaborator

yonzhan commented Oct 1, 2020

@avanigupta We are in Chinese National holiday. @jiasli can help review this PR after holiday. Sorry for the inconvenience caused.

@yungezz
Copy link
Member

yungezz commented Oct 9, 2020

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@fengzhou-msft
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@avanigupta avanigupta force-pushed the avanigupta/aadauthdataplane branch from ba3811f to f3eac0a Compare October 9, 2020 04:37
argcomplete==1.11.1
asn1crypto==0.24.0
azure-appconfiguration==1.1.0
azure-appconfiguration==1.1.1
Copy link
Member

Choose a reason for hiding this comment

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

pls run live test to make sure no breaking change in sdk version bumping

Copy link
Member Author

Choose a reason for hiding this comment

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

I've run all live tests and updated test recordings in this PR.

@yungezz yungezz merged commit aa5c044 into Azure:dev Oct 9, 2020
@avanigupta avanigupta deleted the avanigupta/aadauthdataplane branch October 9, 2020 17:19
Comment on lines +152 to +154
# Due to this bug in get_login_credentials: https://github.com/Azure/azure-cli/issues/15179,
# we need to manage the AAD scope by passing appconfig endpoint as resource
cred, _, _ = profile.get_login_credentials(resource=endpoint)
Copy link
Member

Choose a reason for hiding this comment

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

#15184 has been merged. You may now safely remove resource=endpoint.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants