Skip to content

Commit f9ab285

Browse files
authored
[AppConfig] az appconfig create/update: Add data plane proxy settings (#30228)
1 parent 46da4e9 commit f9ab285

32 files changed

+191610
-131353
lines changed

linter_exclusions.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,14 @@ appconfig update:
728728
encryption_key_version:
729729
rule_exclusions:
730730
- option_length_too_long
731+
enable_arm_private_network_access:
732+
rule_exclusions:
733+
- option_length_too_long
734+
appconfig create:
735+
parameters:
736+
enable_arm_private_network_access:
737+
rule_exclusions:
738+
- option_length_too_long
731739
appservice ase create:
732740
parameters:
733741
force_network_security_group:

src/azure-cli/azure/cli/command_modules/appconfig/_constants.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,8 @@ class ProvisioningStatus:
129129
RUNNING = "Running"
130130
SUCCEEDED = "Succeeded"
131131
FAILED = "Failed"
132+
133+
134+
class ARMAuthenticationMode:
135+
LOCAL = "local"
136+
PASS_THROUGH = "pass-through"

src/azure-cli/azure/cli/command_modules/appconfig/_help.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --sku Standard --assign-identity /subscriptions/<SUBSCRIPTON ID>/resourcegroups/<RESOURCEGROUP>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myUserAssignedIdentity
2929
- name: Create an App Configuration store with name, location and resource group with public network access enabled and local auth disabled.
3030
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --enable-public-network --disable-local-auth
31+
- name: Create an App Configuration store with name, location and resource group with ARM authentication mode set to Pass-through.
32+
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --arm-auth-mode pass-through
33+
- name: Create an App Configuration store with name, location and resource group with ARM authentication mode set to Pass-through and private network access via ARM Private Link enabled.
34+
text: az appconfig create -g MyResourceGroup -n MyAppConfiguration -l westus --arm-auth-mode pass-through --enable-arm-private-network-access true
3135
"""
3236

3337
helps['appconfig list-deleted'] = """
@@ -369,6 +373,10 @@
369373
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --encryption-key-name ""
370374
- name: Update an App Configuration store to enable public network access and disable local auth.
371375
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --enable-public-network true --disable-local-auth true
376+
- name: Update an App Configuration store to set ARM authentication mode set to Pass-through.
377+
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --arm-auth-mode pass-through
378+
- name: Update an App Configuration store to set ARM authentication mode set to Pass-through and enable private network access via ARM Private Link.
379+
text: az appconfig update -g MyResourceGroup -n MyAppConfiguration --arm-auth-mode pass-through --enable-arm-private-network-access true
372380
"""
373381

374382
helps['appconfig feature'] = """

src/azure-cli/azure/cli/command_modules/appconfig/_params.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
resource_group_name_type)
1515
from azure.cli.core.commands.validators import \
1616
get_default_location_from_resource_group
17-
from ._constants import ImportExportProfiles, ImportMode, FeatureFlagConstants
17+
from ._constants import ImportExportProfiles, ImportMode, FeatureFlagConstants, ARMAuthenticationMode
1818

1919
from ._validators import (validate_appservice_name_or_id, validate_sku, validate_snapshot_query_fields,
2020
validate_connection_string, validate_datetime,
@@ -119,6 +119,19 @@ def load_arguments(self, _):
119119
help='Filter snapshots by their status. If no status specified, return all snapshots by default.'
120120
)
121121

122+
arm_auth_mode_arg_type = CLIArgumentType(
123+
options_list=['--arm-auth-mode'],
124+
arg_type=get_enum_type([ARMAuthenticationMode.LOCAL, ARMAuthenticationMode.PASS_THROUGH]),
125+
help="The authentication mode for accessing the App Configuration Store via ARM. 'pass-through' (Recommended) uses Microsoft Entra ID to access the store via ARM with proper authorization.'local' uses access keys for authentication. This requires access keys to be enabled."
126+
)
127+
128+
enable_arm_private_network_access_arg_type = CLIArgumentType(
129+
option_list=['--enable-arm-private-network-access'],
130+
arg_type=get_three_state_flag(),
131+
help="Enable access to the App Configuration store via ARM Private Link if resource is restricted to private network access. Requires Pass-through ARM authentication mode."
132+
133+
)
134+
122135
# Used with data plane commands. These take either a store name or connection string argument.
123136
# We only read default values when neither connection string nor store name is provided so configured defaults are not supplied.
124137
data_plane_name_arg_type = CLIArgumentType(
@@ -160,6 +173,8 @@ def load_arguments(self, _):
160173
c.argument('replica_name', arg_type=store_creation_replica_name_arg_type)
161174
c.argument('replica_location', arg_type=replica_location_arg_type)
162175
c.argument('no_replica', help='Proceed without replica creation for premium tier store.', arg_type=get_three_state_flag())
176+
c.argument('arm_auth_mode', arg_type=arm_auth_mode_arg_type)
177+
c.argument('enable_arm_private_network_access', arg_type=enable_arm_private_network_access_arg_type)
163178

164179
with self.argument_context('appconfig update') as c:
165180
c.argument('sku', help='The sku of the App Configuration store', arg_type=get_enum_type(['Free', 'Premium', 'Standard']))
@@ -168,6 +183,8 @@ def load_arguments(self, _):
168183
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.')
169184
c.argument('disable_local_auth', arg_type=get_three_state_flag(), help='Disable all authentication methods other than AAD authentication.')
170185
c.argument('enable_purge_protection', options_list=['--enable-purge-protection', '-p'], arg_type=get_three_state_flag(), help='Property specifying whether protection against purge is enabled for this App Configuration store. Setting this property to true activates protection against purge for this App Configuration store and its contents. Enabling this functionality is irreversible.')
186+
c.argument('arm_auth_mode', arg_type=arm_auth_mode_arg_type)
187+
c.argument('enable_arm_private_network_access', arg_type=enable_arm_private_network_access_arg_type)
171188

172189
with self.argument_context('appconfig recover') as c:
173190
c.argument('location', arg_type=get_location_type(self.cli_ctx), help='Location of the deleted App Configuration store. Can be viewed using command `az appconfig show-deleted`.')

src/azure-cli/azure/cli/command_modules/appconfig/_validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,14 @@ def validate_snapshot_import(namespace):
377377

378378
def validate_sku(namespace):
379379
if namespace.sku.lower() == 'free':
380-
if (namespace.enable_purge_protection or namespace.retention_days or namespace.replica_name or namespace.replica_location or namespace.no_replica):
380+
if (namespace.enable_purge_protection or namespace.retention_days or namespace.replica_name or namespace.replica_location or namespace.no_replica or namespace.enable_arm_private_network_access): # pylint: disable=too-many-boolean-expressions
381381
logger.warning("Options '--enable-purge-protection', '--replica-name', '--replica-location' , '--no-replica' and '--retention-days' will be ignored when creating a free store.")
382382
namespace.retention_days = None
383383
namespace.enable_purge_protection = None
384384
namespace.replica_name = None
385385
namespace.replica_location = None
386386
namespace.no_replica = None
387+
namespace.enable_arm_private_network_access = None
387388
return
388389

389390
if namespace.sku.lower() == 'premium' and not namespace.no_replica:

src/azure-cli/azure/cli/command_modules/appconfig/custom.py

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
KeyVaultProperties,
2121
RegenerateKeyParameters,
2222
CreateMode,
23-
Replica)
23+
Replica,
24+
AuthenticationMode,
25+
PublicNetworkAccess,
26+
PrivateLinkDelegation,
27+
DataPlaneProxyProperties)
2428
from knack.log import get_logger
2529
from ._utils import resolve_store_metadata, resolve_deleted_store_metadata
26-
from ._constants import ProvisioningStatus
30+
from ._constants import ARMAuthenticationMode, ProvisioningStatus
2731

2832
logger = get_logger(__name__)
2933

@@ -47,13 +51,23 @@ def create_configstore(cmd,
4751
enable_purge_protection=None,
4852
replica_name=None,
4953
replica_location=None,
50-
no_replica=None): # pylint: disable=unused-argument
54+
no_replica=None, # pylint: disable=unused-argument
55+
arm_auth_mode=None,
56+
enable_arm_private_network_access=None):
5157
if assign_identity is not None and not assign_identity:
5258
assign_identity = [SYSTEM_ASSIGNED_IDENTITY]
5359

5460
public_network_access = None
5561
if enable_public_network is not None:
56-
public_network_access = 'Enabled' if enable_public_network else 'Disabled'
62+
public_network_access = PublicNetworkAccess.ENABLED if enable_public_network else PublicNetworkAccess.DISABLED
63+
64+
arm_private_link_delegation = None
65+
if enable_arm_private_network_access is not None:
66+
arm_private_link_delegation = PrivateLinkDelegation.ENABLED if enable_arm_private_network_access else PrivateLinkDelegation.DISABLED
67+
68+
arm_authentication_mode = None
69+
if arm_auth_mode is not None:
70+
arm_authentication_mode = AuthenticationMode.LOCAL if arm_auth_mode == ARMAuthenticationMode.LOCAL else AuthenticationMode.PASS_THROUGH
5771

5872
configstore_params = ConfigurationStore(location=location.lower(),
5973
identity=__get_resource_identity(assign_identity) if assign_identity else None,
@@ -63,7 +77,10 @@ def create_configstore(cmd,
6377
disable_local_auth=disable_local_auth,
6478
soft_delete_retention_in_days=retention_days,
6579
enable_purge_protection=enable_purge_protection,
66-
create_mode=CreateMode.DEFAULT)
80+
create_mode=CreateMode.DEFAULT,
81+
data_plane_proxy=DataPlaneProxyProperties(
82+
authentication_mode=arm_authentication_mode,
83+
private_link_delegation=arm_private_link_delegation))
6784

6885
progress = IndeterminateStandardOut()
6986

@@ -161,19 +178,33 @@ def update_configstore(cmd,
161178
identity_client_id=None,
162179
enable_public_network=None,
163180
disable_local_auth=None,
164-
enable_purge_protection=None):
181+
enable_purge_protection=None,
182+
arm_auth_mode=None,
183+
enable_arm_private_network_access=None):
165184
__validate_cmk(encryption_key_name, encryption_key_vault, encryption_key_version, identity_client_id)
166185
if resource_group_name is None:
167186
resource_group_name, _ = resolve_store_metadata(cmd, name)
168187

169188
public_network_access = None
170189
if enable_public_network is not None:
171-
public_network_access = 'Enabled' if enable_public_network else 'Disabled'
190+
public_network_access = PublicNetworkAccess.ENABLED if enable_public_network else PublicNetworkAccess.DISABLED
191+
192+
arm_private_link_delegation = None
193+
if enable_arm_private_network_access is not None:
194+
arm_private_link_delegation = PrivateLinkDelegation.ENABLED if enable_arm_private_network_access else PrivateLinkDelegation.DISABLED
195+
196+
arm_authentication_mode = None
197+
if arm_auth_mode is not None:
198+
arm_authentication_mode = AuthenticationMode.LOCAL if arm_auth_mode == ARMAuthenticationMode.LOCAL else AuthenticationMode.PASS_THROUGH
199+
172200
update_params = ConfigurationStoreUpdateParameters(tags=tags,
173201
sku=Sku(name=sku) if sku else None,
174202
public_network_access=public_network_access,
175203
disable_local_auth=disable_local_auth,
176-
enable_purge_protection=enable_purge_protection)
204+
enable_purge_protection=enable_purge_protection,
205+
data_plane_proxy=DataPlaneProxyProperties(
206+
authentication_mode=arm_authentication_mode,
207+
private_link_delegation=arm_private_link_delegation))
177208

178209
if encryption_key_name is not None:
179210
key_vault_properties = KeyVaultProperties()

0 commit comments

Comments
 (0)