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

[AppConfiguration] Add support for disable_local_auth #18619

Merged
merged 6 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ def load_arguments(self, _):
help='Space-separated list of managed identities to be assigned. Use "[system]" to refer to system-assigned managed identity or a resource ID to refer to user-assigned managed identity. If this argument is provided without any value, system-assigned managed identity will be assigned by default. If this argument is not provided, no managed identities will be assigned to this App Configuration store.')
c.argument('enable_public_network', options_list=['--enable-public-network', '-e'], arg_type=get_three_state_flag(), is_preview=True,
help='When true, requests coming from public networks have permission to access this store while private endpoint is enabled. When false, only requests made through Private Links can reach this store.')
c.argument('disable_local_auth', arg_type=get_three_state_flag(), is_preview=True, help='Disables all authentication methods other than AAD authentication.')
zhoxing-ms marked this conversation as resolved.
Show resolved Hide resolved

with self.argument_context('appconfig update') as c:
c.argument('tags', arg_type=tags_type)
c.argument('enable_public_network', options_list=['--enable-public-network', '-e'], arg_type=get_three_state_flag(), is_preview=True,
help='When true, requests coming from public networks have permission to access this store while private endpoint is enabled. When false, only requests made through Private Links can reach this store.')
c.argument('disable_local_auth', arg_type=get_three_state_flag(), is_preview=True, help='Disables all authentication methods other than AAD authentication.')
zhoxing-ms marked this conversation as resolved.
Show resolved Hide resolved

with self.argument_context('appconfig update', arg_group='Customer Managed Key') as c:
c.argument('encryption_key_name', help='The name of the KeyVault key.')
Expand Down
12 changes: 8 additions & 4 deletions src/azure-cli/azure/cli/command_modules/appconfig/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def create_configstore(client,
location,
sku="Standard",
assign_identity=None,
enable_public_network=None):
enable_public_network=None,
disable_local_auth=None):
Copy link
Member

Choose a reason for hiding this comment

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

Could you also add some sample commands in the help file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sample added.

if assign_identity is not None and not assign_identity:
assign_identity = [SYSTEM_ASSIGNED_IDENTITY]

Expand All @@ -45,7 +46,8 @@ def create_configstore(client,
configstore_params = ConfigurationStore(location=location.lower(),
identity=__get_resource_identity(assign_identity) if assign_identity else None,
sku=Sku(name=sku),
public_network_access=public_network_access)
public_network_access=public_network_access,
disable_local_auth=disable_local_auth)

return client.begin_create(resource_group_name, name, configstore_params)

Expand Down Expand Up @@ -79,7 +81,8 @@ def update_configstore(cmd,
encryption_key_vault=None,
encryption_key_version=None,
identity_client_id=None,
enable_public_network=None):
enable_public_network=None,
disable_local_auth=None):
__validate_cmk(encryption_key_name, encryption_key_vault, encryption_key_version, identity_client_id)
if resource_group_name is None:
resource_group_name, _ = resolve_store_metadata(cmd, name)
Expand All @@ -89,7 +92,8 @@ def update_configstore(cmd,
public_network_access = 'Enabled' if enable_public_network else 'Disabled'
update_params = ConfigurationStoreUpdateParameters(tags=tags if tags else None,
sku=Sku(name=sku) if sku else None,
public_network_access=public_network_access)
public_network_access=public_network_access,
disable_local_auth=disable_local_auth)

if encryption_key_name is not None:
key_vault_properties = KeyVaultProperties()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed May 26 14:26:40 China Standard Time 2021
#Wed Jun 23 13:29:39 Pacific Daylight Time 2021
Color=Red
Region=West US
feature-management.FalseFeature=false
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
interactions:
- request:
body: '{"location": "eastus", "sku": {"name": "Standard"}, "properties": {"disableLocalAuth":
true}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- appconfig create
Connection:
- keep-alive
Content-Length:
- '93'
Content-Type:
- application/json
ParameterSetName:
- -n -g -l --sku --disable-local-auth
User-Agent:
- AZURECLI/2.23.0 (MSI) azsdk-python-mgmt-appconfiguration/0.1.0 Python/3.8.2
(Windows-10-10.0.19041-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.AppConfiguration/configurationStores/LocalAuthTest000002?api-version=2021-03-01-preview
response:
body:
string: '{"type":"Microsoft.AppConfiguration/configurationStores","location":"eastus","properties":{"provisioningState":"Creating","creationDate":"2021-05-19T19:15:34.5227378+00:00","endpoint":null,"encryption":null,"privateEndpointConnections":null,"disableLocalAuth":null},"sku":{"name":"Standard"},"systemData":null,"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.AppConfiguration/configurationStores/LocalAuthTest000002","name":"LocalAuthTest000002","tags":{}}'
headers:
azure-asyncoperation:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AppConfiguration/locations/eastus/operationsStatus/24437ea6-3aec-ed27-b277-5fee68798779?api-version=2021-03-01-preview
cache-control:
- no-cache
content-length:
- '586'
content-type:
- application/json; charset=utf-8
date:
- Wed, 19 May 2021 19:15:34 GMT
expires:
- '-1'
pragma:
- no-cache
server:
- nginx/1.17.10
strict-transport-security:
- max-age=31536000; includeSubDomains
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
status:
code: 201
message: Created
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- appconfig create
Connection:
- keep-alive
ParameterSetName:
- -n -g -l --sku --disable-local-auth
User-Agent:
- AZURECLI/2.23.0 (MSI) azsdk-python-mgmt-appconfiguration/0.1.0 Python/3.8.2
(Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AppConfiguration/locations/eastus/operationsStatus/24437ea6-3aec-ed27-b277-5fee68798779?api-version=2021-03-01-preview
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AppConfiguration/locations/eastus/operationsStatus/24437ea6-3aec-ed27-b277-5fee68798779","name":"24437ea6-3aec-ed27-b277-5fee68798779","status":"Succeeded","error":null}'
headers:
azure-asyncoperation:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AppConfiguration/locations/eastus/operationsStatus/24437ea6-3aec-ed27-b277-5fee68798779?api-version=2021-03-01-preview
cache-control:
- no-cache
content-length:
- '248'
content-type:
- application/json; charset=utf-8
date:
- Wed, 19 May 2021 19:15:44 GMT
expires:
- '-1'
pragma:
- no-cache
server:
- nginx/1.17.10
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
CommandName:
- appconfig create
Connection:
- keep-alive
ParameterSetName:
- -n -g -l --sku --disable-local-auth
User-Agent:
- AZURECLI/2.23.0 (MSI) azsdk-python-mgmt-appconfiguration/0.1.0 Python/3.8.2
(Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.AppConfiguration/configurationStores/LocalAuthTest000002?api-version=2021-03-01-preview
response:
body:
string: '{"type":"Microsoft.AppConfiguration/configurationStores","location":"eastus","properties":{"provisioningState":"Succeeded","creationDate":"2021-05-19T19:15:36+00:00","endpoint":"https://localauthtests2ayr3o4iua.azconfig.io","encryption":{"keyVaultProperties":null},"privateEndpointConnections":null,"disableLocalAuth":true},"sku":{"name":"standard"},"systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2021-05-19T19:15:36+00:00","lastModifiedBy":"[email protected]","lastModifiedByType":"User","lastModifiedAt":"2021-05-19T19:15:36+00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.AppConfiguration/configurationStores/localauthtests2ayr3o4iua","name":"LocalAuthTest000002","tags":{}}'
headers:
cache-control:
- no-cache
content-length:
- '854'
content-type:
- application/json; charset=utf-8
date:
- Wed, 19 May 2021 19:15:44 GMT
etag:
- W/"2500adcc-0000-0100-0000-60a563d70000"
expires:
- '-1'
pragma:
- no-cache
server:
- nginx/1.17.10
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
status:
code: 200
message: OK
- request:
body: '{"properties": {"disableLocalAuth": false}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- appconfig update
Connection:
- keep-alive
Content-Length:
- '43'
Content-Type:
- application/json
ParameterSetName:
- -n -g --disable-local-auth
User-Agent:
- AZURECLI/2.23.0 (MSI) azsdk-python-mgmt-appconfiguration/0.1.0 Python/3.8.2
(Windows-10-10.0.19041-SP0)
method: PATCH
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.AppConfiguration/configurationStores/LocalAuthTest000002?api-version=2021-03-01-preview
response:
body:
string: '{"type":"Microsoft.AppConfiguration/configurationStores","location":"eastus","properties":{"provisioningState":"Succeeded","creationDate":"2021-05-19T19:15:36+00:00","endpoint":"https://localauthtests2ayr3o4iua.azconfig.io","encryption":{"keyVaultProperties":null},"privateEndpointConnections":null,"disableLocalAuth":false},"sku":{"name":"standard"},"systemData":{"createdBy":"[email protected]","createdByType":"User","createdAt":"2021-05-19T19:15:36+00:00","lastModifiedBy":"[email protected]","lastModifiedByType":"User","lastModifiedAt":"2021-05-19T19:15:46+00:00"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.AppConfiguration/configurationStores/localauthtests2ayr3o4iua","name":"LocalAuthTest000002","tags":{}}'
headers:
cache-control:
- no-cache
content-length:
- '855'
content-type:
- application/json; charset=utf-8
date:
- Wed, 19 May 2021 19:15:45 GMT
etag:
- W/"2500f0cc-0000-0100-0000-60a563e10000"
expires:
- '-1'
pragma:
- no-cache
server:
- nginx/1.17.10
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding,Accept-Encoding
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
status:
code: 200
message: OK
version: 1
Loading