-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[App Config] az appconfig: Add anonymous auth mode
#32639
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
base: dev
Are you sure you want to change the base?
[App Config] az appconfig: Add anonymous auth mode
#32639
Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| appconfig feature delete | cmd appconfig feature delete update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature disable | cmd appconfig feature disable update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature enable | cmd appconfig feature enable update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature filter add | cmd appconfig feature filter add update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature filter delete | cmd appconfig feature filter delete update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature filter list | cmd appconfig feature filter list update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature filter show | cmd appconfig feature filter show update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature filter update | cmd appconfig feature filter update update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature list | cmd appconfig feature list update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature lock | cmd appconfig feature lock update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature set | cmd appconfig feature set update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature show | cmd appconfig feature show update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig feature unlock | cmd appconfig feature unlock update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv delete | cmd appconfig kv delete update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv export | cmd appconfig kv export update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv export | cmd appconfig kv export update parameter dest_auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv import | cmd appconfig kv import update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv import | cmd appconfig kv import update parameter src_auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv list | cmd appconfig kv list update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv lock | cmd appconfig kv lock update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv restore | cmd appconfig kv restore update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv set | cmd appconfig kv set update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv set-keyvault | cmd appconfig kv set-keyvault update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv show | cmd appconfig kv show update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig kv unlock | cmd appconfig kv unlock update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig revision list | cmd appconfig revision list update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig snapshot archive | cmd appconfig snapshot archive update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig snapshot create | cmd appconfig snapshot create update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig snapshot list | cmd appconfig snapshot list update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig snapshot recover | cmd appconfig snapshot recover update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
||
| appconfig snapshot show | cmd appconfig snapshot show update parameter auth_mode: updated property choices from ['key', 'login'] to ['anonymous', 'key', 'login'] |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
az appconfig: Adding anonymous auth modeaz appconfig: Add anonymous auth mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
|
|
||
| if auth_mode == "anonymous": | ||
| try: | ||
| connection_string = "Endpoint={};Id=test-id;Secret=abcdefghijklmnopqrstuvwxyz1234567890".format(endpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of faking a connection string, can we rather pass endpoint and an AzureKeyCredential with an empty secret? e.g,
azconfig_client = AzureAppConfigurationClient(credential=AzureKeyCredential(""),
base_url=endpoint,
user_agent=HttpHeaders.USER_AGENT)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 27 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
…istineWanjau/azure-cli into cwanjau/addAnonymousAuthMode
| self.cmd('appconfig kv list --auth-mode login --endpoint http://localhost:8080') | ||
|
|
||
| # key auth mode with http endpoint in connection string should fail | ||
| with self.assertRaisesRegex(CLIError, "HTTP endpoint is only supported when auth mode is 'anonymous'."): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no successful state we can test? I'm assuming that is hard as we might not have a way to use the emulator.
| c.argument('fields', arg_type=fields_arg_type) | ||
| c.argument('endpoint', help='If auth mode is "login", provide endpoint URL of the App Configuration store. The endpoint can be retrieved using "az appconfig show" command. You can configure the default endpoint using `az configure --defaults appconfig_endpoint=<endpoint>`', configured_default='appconfig_endpoint') | ||
| c.argument('auth_mode', arg_type=get_enum_type(['login', 'key']), configured_default='appconfig_auth_mode', validator=validate_auth_mode, | ||
| c.argument('endpoint', help='If auth mode is "login" or "anonymous", provide endpoint URL of the App Configuration store. The endpoint can be retrieved using "az appconfig show" command. You can configure the default endpoint using `az configure --defaults appconfig_endpoint=<endpoint>`', configured_default='appconfig_endpoint') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is saying anonymous useful here as the simulator is also a requirement. It could mislead someone to thinking our service allows it.
| if endpoint and is_http_endpoint(endpoint): | ||
| raise CLIError("HTTP endpoint is only supported when auth mode is 'anonymous'.") | ||
|
|
||
| if connection_string: | ||
| conn_endpoint = get_store_endpoint_from_connection_string(connection_string) | ||
| if is_http_endpoint(conn_endpoint): | ||
| raise CLIError("HTTP endpoint is only supported when auth mode is 'anonymous'.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if endpoint and is_http_endpoint(endpoint): | |
| raise CLIError("HTTP endpoint is only supported when auth mode is 'anonymous'.") | |
| if connection_string: | |
| conn_endpoint = get_store_endpoint_from_connection_string(connection_string) | |
| if is_http_endpoint(conn_endpoint): | |
| raise CLIError("HTTP endpoint is only supported when auth mode is 'anonymous'.") | |
| if connection_string: | |
| endpoint = get_store_endpoint_from_connection_string(connection_string) | |
| if endpoint and is_http_endpoint(endpoint): | |
| raise CLIError("HTTP endpoint is only supported when auth mode is 'anonymous'.") |
I'm not sure if this works with like 83 as I'm not familiar with namespace.name but you could always add a line before to get a temp value so we don't have this twice.
Related command
az appconfig
Description
This PR adds a new anonymous auth mode that is only used with http endpoints.
Testing Guide
az appconfig kv list --auth-mode anonymous --endpoint http://example.com
History Notes
[Component Name 2]
az appconfig: Add anonymous auth modeThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.