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 5 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
8 changes: 4 additions & 4 deletions src/azure-cli/azure/cli/command_modules/appconfig/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --sku Standard --assign-identity
- name: Create an App Configuration with name, location, sku and resource group with user assigned identity.
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --sku Standard --assign-identity /subscriptions/<SUBSCRIPTON ID>/resourcegroups/<RESOURCEGROUP>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myUserAssignedIdentity
- name: Create an App Configuration with name, location and resource group and enable public network access.
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --enable-public-network
- name: Create an App Configuration with name, location and resource group with public network access enabled and local auth disabled.
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --enable-public-network --disable-local-auth
"""

helps['appconfig identity'] = """
Expand Down Expand Up @@ -283,8 +283,8 @@
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --encryption-key-name myKey --encryption-key-version keyVersion --encryption-key-vault https://keyVaultName.vault.azure.net
- name: Remove customer encryption key
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --encryption-key-name ""
- name: Update an App Configuration to enable public network access.
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --enable-public-network true
- name: Update an App Configuration to enable public network access and disable local auth.
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --enable-public-network true --disable-local-auth true
"""

helps['appconfig feature'] = """
Expand Down
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='Disable all authentication methods other than AAD authentication.')

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='Disable all authentication methods other than AAD authentication.')

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,11 +1,11 @@
{
"Color": "Red",
"Region": "West US",
"feature_management": {
"FeatureManagement": {
"Beta": false,
"Percentage": true,
"Timestamp": {
"enabled_for": [
"EnabledFor": [
{
"Name": "Local Tests",
"Parameters": {
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
#Thu Jun 24 18:13:58 Pacific Daylight Time 2021
Color=Red
Region=West US
feature-management.FalseFeature=false
Expand Down
Loading