Skip to content

Commit f745903

Browse files
committed
b4
1 parent 692d198 commit f745903

13 files changed

Lines changed: 19 additions & 664 deletions

File tree

azext_iot/adr/_help.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ def load_adr_help():
3333
short-summary: Create a Device Registry namespace.
3434
long-summary: |
3535
By default, a namespace is created with a system-assigned managed identity.
36-
To create a credential and credential policy, use `--enable-certificate-management` or provide any policy parameters.
36+
To bootstrap a default credential and credential policy (deprecated), provide any policy parameters.
3737
The policy resource name can be customized with the --policy-name argument, but the 'default' credential name cannot be changed.
3838
examples:
3939
- name: Create a basic Device Registry namespace
4040
text: az iot adr ns create -n myNamespace -g myResourceGroup
41-
- name: Create a Device Registry namespace with credential and default policy
42-
text: az iot adr ns create -n myNamespace -g myResourceGroup --enable-certificate-management
41+
- name: Create a Device Registry namespace with a default credential policy (deprecated)
42+
text: az iot adr ns create -n myNamespace -g myResourceGroup --policy-name default
4343
- name: Create a Device Registry namespace with custom credential policy
4444
text: az iot adr ns create -n myNamespace -g myResourceGroup --policy-name myPolicy --cert-validity-days 30
4545
- name: Create a Device Registry namespace with system-assigned outbound identity
@@ -251,9 +251,6 @@ def load_adr_help():
251251
] = """
252252
type: group
253253
short-summary: Manage certificate authorities for a Device Registry namespace.
254-
long-summary: |
255-
Certificate authorities require certificate management to be enabled on the namespace
256-
(see 'az iot adr ns create --enable-certificate-management').
257254
"""
258255

259256
helps[

azext_iot/adr/commands_namespace.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def adr_namespace_create(
1919
resource_group_name: str,
2020
location: Optional[str] = None,
2121
tags: Optional[Dict[str, str]] = None,
22-
enable_certificate_management: Optional[bool] = None,
2322
policy_name: Optional[str] = None,
2423
certificate_key_type: Optional[str] = None,
2524
certificate_subject: Optional[str] = None,
@@ -34,7 +33,6 @@ def adr_namespace_create(
3433
resource_group_name=resource_group_name,
3534
location=location,
3635
tags=tags,
37-
enable_certificate_management=enable_certificate_management,
3836
policy_name=policy_name,
3937
certificate_key_type=certificate_key_type,
4038
certificate_subject=certificate_subject,
@@ -69,7 +67,6 @@ def adr_namespace_update(
6967
namespace_name: str,
7068
resource_group_name: str,
7169
tags: Optional[Dict[str, str]] = None,
72-
enable_certificate_management: Optional[bool] = None,
7370
outbound_mi_system_assigned: Optional[bool] = None,
7471
outbound_mi_user_assigned: Optional[str] = None,
7572
no_wait: bool = False,
@@ -79,7 +76,6 @@ def adr_namespace_update(
7976
namespace_name=namespace_name,
8077
resource_group_name=resource_group_name,
8178
tags=tags,
82-
enable_certificate_management=enable_certificate_management,
8379
outbound_mi_system_assigned=outbound_mi_system_assigned,
8480
outbound_mi_user_assigned=outbound_mi_user_assigned,
8581
no_wait=no_wait,

azext_iot/adr/common.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ class CertificateAuthorityKeyType(Enum):
109109
ecc = "ECC"
110110

111111

112-
class CertificateManagementState(Enum):
113-
enabled = "Enabled"
114-
disabled = "Disabled"
115-
116-
117112
# Endpoint type discriminators on Namespace messaging / provisioning / updating endpoints
118113
IOT_HUB_ENDPOINT_TYPE = "Microsoft.Devices/IotHubs"
119114
DPS_ENDPOINT_TYPE = "Microsoft.Devices/provisioningServices"

azext_iot/adr/params.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ def load_adr_arguments(self, _):
4646
arg_type=get_location_type(self.cli_ctx),
4747
validator=get_default_location_from_resource_group,
4848
)
49-
# Enable certificate management (namespace-level certificateManagement state)
50-
context.argument(
51-
"enable_certificate_management",
52-
arg_group="Credential",
53-
options_list=["--enable-certificate-management", "--ecm"],
54-
arg_type=get_three_state_flag(),
55-
help="Set the namespace certificate management state. When enabled, the namespace uses "
56-
"cloud PKI-backed certificate lifecycle operations managed via 'iot adr ns ca'.",
57-
)
5849
context.argument(
5950
"policy_name",
6051
arg_group="Policy",
@@ -362,15 +353,6 @@ def load_adr_arguments(self, _):
362353
"NOTE: Currently unsupported.",
363354
)
364355

365-
with self.argument_context("iot adr ns update") as context:
366-
context.argument(
367-
"enable_certificate_management",
368-
arg_group="Credential",
369-
options_list=["--enable-certificate-management", "--ecm"],
370-
arg_type=get_three_state_flag(),
371-
help="Enable or disable certificate management state for this Device Registry namespace.",
372-
)
373-
374356
# Link hub arguments
375357
with self.argument_context("iot adr ns link hub") as context:
376358
context.argument(

azext_iot/adr/providers/namespace.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
DEFAULT_NS_POLICY_NAME,
1717
DEFAULT_NS_POLICY_CERT_KEY_TYPE,
1818
DEFAULT_NS_POLICY_CERT_VALIDITY_DAYS,
19-
CertificateManagementState,
2019
IdentityType,
2120
build_mi_body,
2221
)
@@ -76,7 +75,6 @@ def create(
7675
resource_group_name: str,
7776
location: Optional[str] = None,
7877
tags: Optional[Dict[str, str]] = None,
79-
enable_certificate_management: Optional[bool] = None,
8078
policy_name: Optional[str] = None,
8179
certificate_key_type: Optional[str] = None,
8280
certificate_subject: Optional[str] = None,
@@ -86,9 +84,7 @@ def create(
8684
**kwargs,
8785
):
8886
# Legacy credential/policy bootstrap (DEPRECATED): triggered only by explicit legacy policy
89-
# args. `--enable-certificate-management` no longer drives this; it now solely sets the
90-
# namespace-level `certificateManagement` state (the real API field). Certificate authorities
91-
# and policies are managed via `iot adr ns ca`.
87+
# args. Certificate authorities and policies are managed via `iot adr ns ca`.
9288
should_create_credential_policy = any([
9389
policy_name,
9490
certificate_key_type,
@@ -97,13 +93,6 @@ def create(
9793
])
9894

9995
if should_create_credential_policy:
100-
# Contradictory inputs: cannot bootstrap a credential policy while disabling cert management
101-
if enable_certificate_management is False:
102-
raise MutuallyExclusiveArgumentError(
103-
"Cannot create a custom credential policy while "
104-
"`--enable-certificate-management` is false."
105-
)
106-
10796
logger.warning(
10897
"Creating a default credential and credential policy is deprecated and will be "
10998
"removed in a future release. Use 'az iot adr ns ca' to manage certificate "
@@ -132,12 +121,6 @@ def create(
132121
)
133122

134123
properties = {}
135-
if enable_certificate_management is not None:
136-
properties["certificateManagement"] = (
137-
CertificateManagementState.enabled.value
138-
if enable_certificate_management
139-
else CertificateManagementState.disabled.value
140-
)
141124
if outbound_identity is not None:
142125
properties["outboundIdentity"] = outbound_identity
143126
if properties:
@@ -225,7 +208,6 @@ def update(
225208
namespace_name: str,
226209
resource_group_name: str,
227210
tags: Optional[Dict[str, str]] = None,
228-
enable_certificate_management: Optional[bool] = None,
229211
outbound_mi_system_assigned: Optional[bool] = None,
230212
outbound_mi_user_assigned: Optional[str] = None,
231213
**kwargs,
@@ -236,12 +218,6 @@ def update(
236218
body["tags"] = tags
237219

238220
properties: dict = {}
239-
if enable_certificate_management is not None:
240-
properties["certificateManagement"] = (
241-
CertificateManagementState.enabled.value
242-
if enable_certificate_management
243-
else CertificateManagementState.disabled.value
244-
)
245221

246222
outbound_identity = _resolve_outbound_identity(
247223
outbound_mi_system_assigned, outbound_mi_user_assigned

0 commit comments

Comments
 (0)