-
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?
Changes from all commits
c943ffa
7b55e08
8c7d877
934870a
8be2530
5ed88f6
50e6874
c4dca23
8009239
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,8 +19,10 @@ | |||||||||||||||||||||||
| from ._utils import (is_valid_connection_string, | ||||||||||||||||||||||||
| resolve_store_metadata, | ||||||||||||||||||||||||
| get_store_name_from_connection_string, | ||||||||||||||||||||||||
| get_store_endpoint_from_connection_string, | ||||||||||||||||||||||||
| validate_feature_flag_name, | ||||||||||||||||||||||||
| validate_feature_flag_key) | ||||||||||||||||||||||||
| validate_feature_flag_key, | ||||||||||||||||||||||||
| is_http_endpoint) | ||||||||||||||||||||||||
| from ._models import QueryFields | ||||||||||||||||||||||||
| from ._constants import ImportExportProfiles | ||||||||||||||||||||||||
| from ._featuremodels import FeatureQueryFields | ||||||||||||||||||||||||
|
|
@@ -64,12 +66,31 @@ def validate_connection_string(cmd, namespace): | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def validate_auth_mode(namespace): | ||||||||||||||||||||||||
| auth_mode = namespace.auth_mode | ||||||||||||||||||||||||
| endpoint = getattr(namespace, 'endpoint', None) | ||||||||||||||||||||||||
| connection_string = getattr(namespace, 'connection_string', None) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if auth_mode != "anonymous": | ||||||||||||||||||||||||
| # Disallow HTTP endpoints unless explicitly using anonymous mode. | ||||||||||||||||||||||||
| 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'.") | ||||||||||||||||||||||||
|
Comment on lines
+74
to
+80
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I'm not sure if this works with like 83 as I'm not familiar with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I am not sure I understand. Getting the endpoint parameter twice? |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if auth_mode == "login": | ||||||||||||||||||||||||
| if not namespace.name and not namespace.endpoint: | ||||||||||||||||||||||||
| if not namespace.name and not endpoint: | ||||||||||||||||||||||||
| raise CLIError("App Configuration name or endpoint should be provided if auth mode is 'login'.") | ||||||||||||||||||||||||
| if namespace.connection_string: | ||||||||||||||||||||||||
| if connection_string: | ||||||||||||||||||||||||
| raise CLIError("Auth mode should be 'key' when connection string is provided.") | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if auth_mode == "anonymous": | ||||||||||||||||||||||||
| if not endpoint: | ||||||||||||||||||||||||
| raise RequiredArgumentMissingError("App Configuration endpoint should be provided if auth mode is 'anonymous'.") | ||||||||||||||||||||||||
| if connection_string: | ||||||||||||||||||||||||
| raise CLIError("Auth mode 'anonymous' only supports the '--endpoint' argument. Connection string is not supported.") | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def validate_import_depth(namespace): | ||||||||||||||||||||||||
| depth = namespace.depth | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
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
anonymoususeful here as the simulator is also a requirement. It could mislead someone to thinking our service allows it.Uh oh!
There was an error while loading. Please reload this page.
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.
Maybe we can mention in our help texts anonymous is only used with the app configuration emulator?