Skip to content

az iot dps enrollment update --allocation-policy static --iot-hubs new-iothub inserts an additional_properties to the initial twin #31673

@absoluteSloth

Description

@absoluteSloth

Describe the bug

When changing the statically assigned iothub for a single device enrollment, the initial twin properties get all copied under a key named additional_properties.
We would expect that this optional value would be untouched by the command.

There is a workaround where you query the current initial-twin-properties and set it with the command.

Related command

Failing command:
az iot dps enrollment update -g "$RG" -n "$DPS" --enrollment-id "$ID" --allocation-policy static --iot-hubs "$NEW_IOT_HUB" --output none

Workaround:

TWIN=$(az iot dps enrollment show -g "$RG" -n "$DPS" --enrollment-id "$ID" --query "initialTwin.properties.desired")
az iot dps enrollment update -g "$RG" -n "$DPS" --enrollment-id "$ID" --allocation-policy static --iot-hubs "$NEW_IOT_HUB" **--initial-twin-properties "$TWIN"** --output none

Errors

The initial twin is polluted with an additional_properties
Image

Issue script & Debug output

DEBUG: cli.knack.cli: Command arguments: ['iot', 'dps', 'enrollment', 'update', '-g', 'playground-rdrouin', '-n', 'rdrouin-dps', '--enrollment-id', 'device1', '--allocation-policy', 'static', '--iot-hubs', 'rdrouin-hub1.azure-devices.net', '--debug']
DEBUG: cli.knack.cli: init debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f55788c6020>, <function OutputProducer.on_global_arguments at 0x7f55785bf740>, <function CLIQuery.on_global_arguments at 0x7f55785fccc0>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'iot': ['azure.cli.command_modules.iot', 'azext_iot']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
DEBUG: cli.azure.cli.core: iot 0.948 19 82
DEBUG: cli.azure.cli.core: Total (1) 0.948 19 82
DEBUG: cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_next']
DEBUG: cli.azure.cli.core: Loading extensions:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands Directory
DEBUG: cli.azure.cli.core: ai-examples 0.236 1 1 /usr/lib/python3.12/site-packages/azure-cli-extensions/ai-examples
DEBUG: cli.azure.cli.core: azure-iot 0.124 103 337 /home/rdrouin/.azure/cliextensions/azure-iot
DEBUG: cli.azure.cli.core: Total (2) 0.360 104 338
DEBUG: cli.azure.cli.core: Loaded 118 groups, 420 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command : iot dps enrollment update
DEBUG: cli.azure.cli.core: Command table: iot dps enrollment update
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f5577708720>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/rdrouin/.azure/commands/2025-06-19.16-54-02.iot_dps_enrollment_update.4118.log'.
INFO: az_command_data_logger: command args: iot dps enrollment update -g {} -n {} --enrollment-id {} --allocation-policy {} --iot-hubs {} --debug
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f557775ce00>]
DEBUG: cli.azure.cli.core: Current cloud config:
AzureCloud
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f55777880e0>, <function register_cache_arguments..add_cache_arguments at 0x7f5577788220>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x7f55777882c0>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f55785bf7e0>, <function CLIQuery.handle_query_parameter at 0x7f55785fcd60>, <function register_ids_argument..parse_ids_arguments at 0x7f5577788180>]
INFO: az_command_data_logger: extension name: azure-iot
INFO: az_command_data_logger: extension version: 0.23.0
DEBUG: cli.azure.cli.core.commands.client_factory: Getting management service client client_type=IotDpsClient
DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
DEBUG: msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/common/
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): login.microsoftonline.com:443
DEBUG: urllib3.connectionpool: https://login.microsoftonline.com:443 "GET /common//v2.0/.well-known/openid-configuration HTTP/1.1" 200 1547
DEBUG: msal.authority: openid_config("https://login.microsoftonline.com/common//v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/common/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/common/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/{tenantid}/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/common/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/common/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/common/kerberos', 'tenant_region_scope': None, 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
DEBUG: msal.application: Broker enabled? None
DEBUG: cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token_info: scopes=('https://management.core.windows.net//.default',), options={}
DEBUG: cli.azure.cli.core.auth.msal_credentials: CloudShellCredential.acquire_token: scopes=['https://management.core.windows.net//.default'], kwargs={}
DEBUG: urllib3.connectionpool: Starting new HTTP connection (1): localhost:50342
DEBUG: urllib3.connectionpool: http://localhost:50342 "POST /oauth2/token HTTP/1.1" 200 10938
DEBUG: msal.token_cache: event={
"authority_type": "CLOUDSHELL",
"client_id": "04b07795-8ddb-461a-bbee-02f9e1bf7b46",
"data": {},
"response": {
"access_token": "",
"client_info": "eyJ1aWQiOiAiMWYzZDdiNzQtODhmMS00M2RkLWI3MDQtODNhYmVhNmNkNTRkIiwgInV0aWQiOiAiN2JhOGQyZmItNDY2MC00YTE5LTgwMmUtNGQwMTVhMTdlMTY3In0=",
"expires_in": 1006,
"id_token_claims": "
",
"token_type": "Bearer"
},
"scope": [
"https://management.core.windows.net//.default"
],
"token_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token"
}
DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/********/resourceGroups/playground-rdrouin/providers/Microsoft.Devices/provisioningServices/rdrouin-dps?api-version=2021-10-15'
DEBUG: cli.azure.cli.core.sdk.policies: Request method: 'GET'
DEBUG: cli.azure.cli.core.sdk.policies: Request headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'fff66b2c-4d2d-11f0-a201-00155d9e4d8e'
DEBUG: cli.azure.cli.core.sdk.policies: 'CommandName': 'iot dps enrollment update'
DEBUG: cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n --enrollment-id --allocation-policy --iot-hubs --debug'
DEBUG: cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.71.0 (RPM) azsdk-python-core/1.31.0 Python/3.12.9 (Linux-6.1.124.1-microsoft-standard-x86_64-with-glibc2.38) cloud-shell/1.0'
DEBUG: cli.azure.cli.core.sdk.policies: 'Authorization': ''
DEBUG: cli.azure.cli.core.sdk.policies: Request body:
DEBUG: cli.azure.cli.core.sdk.policies: This request has no body
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
DEBUG: urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/
/resourceGroups/playground-rdrouin/providers/Microsoft.Devices/provisioningServices/rdrouin-dps?api-version=2021-10-15 HTTP/1.1" 200 1134
DEBUG: cli.azure.cli.core.sdk.policies: Response status: 200
DEBUG: cli.azure.cli.core.sdk.policies: Response headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Length': '1134'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: cli.azure.cli.core.sdk.policies: 'Expires': '-1'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '249'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-reads': '3749'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '7f85f7b1-0b5b-4ed0-911a-428d538e9034'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '7f85f7b1-0b5b-4ed0-911a-428d538e9034'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20250619T165403Z:7f85f7b1-0b5b-4ed0-911a-428d538e9034'
DEBUG: cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: B4FC67FFFDCF4A1D8E0CEC83A61C45A4 Ref B: BL2AA2011004034 Ref C: 2025-06-19T16:54:03Z'
DEBUG: cli.azure.cli.core.sdk.policies: 'Date': 'Thu, 19 Jun 2025 16:54:02 GMT'
DEBUG: cli.azure.cli.core.sdk.policies: Response content:
DEBUG: cli.azure.cli.core.sdk.policies: {"etag":"AAAAACaDEwU=","name":"rdrouin-dps","location":"eastus","properties":{"state":"Active","provisioningState":"Succeeded","iotHubs":[{"name":"rdrouin-hub1.azure-devices.net","connectionString":"HostName=rdrouin-hub1.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=","location":"eastus","authenticationType":"KeyBased"},{"name":"rdrouin-hub2.azure-devices.net","connectionString":"HostName=rdrouin-hub2.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=","location":"eastus","authenticationType":"KeyBased"}],"allocationPolicy":"Static","serviceOperationsHostName":"rdrouin-dps.azure-devices-provisioning.net","deviceProvisioningHostName":"global.azure-devices-provisioning.net","idScope":"0ne00F8CE56","enableDataResidency":false},"resourcegroup":"playground-rdrouin","type":"Microsoft.Devices/provisioningServices","id":"/subscriptions/
/resourceGroups/playground-rdrouin/providers/Microsoft.Devices/provisioningServices/rdrouin-dps","subscriptionid":"","tags":{},"sku":{"name":"S1","tier":"Standard","capacity":1}}
DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/********/resourceGroups/playground-rdrouin/providers/Microsoft.Devices/provisioningServices/rdrouin-dps/listkeys?api-version=2021-10-15'
DEBUG: cli.azure.cli.core.sdk.policies: Request method: 'POST'
DEBUG: cli.azure.cli.core.sdk.policies: Request headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'fff66b2c-4d2d-11f0-a201-00155d9e4d8e'
DEBUG: cli.azure.cli.core.sdk.policies: 'CommandName': 'iot dps enrollment update'
DEBUG: cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n --enrollment-id --allocation-policy --iot-hubs --debug'
DEBUG: cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.71.0 (RPM) azsdk-python-core/1.31.0 Python/3.12.9 (Linux-6.1.124.1-microsoft-standard-x86_64-with-glibc2.38) cloud-shell/1.0'
DEBUG: cli.azure.cli.core.sdk.policies: 'Authorization': '
'
DEBUG: cli.azure.cli.core.sdk.policies: Request body:
DEBUG: cli.azure.cli.core.sdk.policies: This request has no body
DEBUG: urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/
******/resourceGroups/playground-rdrouin/providers/Microsoft.Devices/provisioningServices/rdrouin-dps/listkeys?api-version=2021-10-15 HTTP/1.1" 200 429
DEBUG: cli.azure.cli.core.sdk.policies: Response status: 200
DEBUG: cli.azure.cli.core.sdk.policies: Response headers:
DEBUG: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Length': '429'
DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: cli.azure.cli.core.sdk.policies: 'Expires': '-1'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-operation-identifier': 'tenantId=7ba8d2fb-4660-4a19-802e-4d015a17e167,objectId=1f3d7b74-88f1-43dd-b704-83abea6cd54d/eastus/fed1a62f-c35b-4dd0-9012-404ec484fbba'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '199'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-writes': '2999'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '30179870-144b-4456-8d6f-873c988e6096'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '30179870-144b-4456-8d6f-873c988e6096'
DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20250619T165403Z:30179870-144b-4456-8d6f-873c988e6096'
DEBUG: cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
DEBUG: cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: A82CD23A19F04556986C1C151DF1C53E Ref B: BL2AA2011004034 Ref C: 2025-06-19T16:54:03Z'
DEBUG: cli.azure.cli.core.sdk.policies: 'Date': 'Thu, 19 Jun 2025 16:54:02 GMT'
DEBUG: cli.azure.cli.core.sdk.policies: Response content:
DEBUG: cli.azure.cli.core.sdk.policies: {"value":[{"keyName":"provisioningserviceowner","primaryKey":"cZ4jmLDFoYqnLuHYb2vuaPTDeVC2jUNrCAIoTLieorY=","secondaryKey":"1hENIqYJ9vRnyvMcAZHFjSldN9T5VGPhWAIoTCwvHOc=","rights":"ServiceConfig, EnrollmentWrite, DeviceConnect"},{"keyName":"device","primaryKey":"gyzPSK/MHE+f6EzT3FGXz+RxzRhm/Qh7wAIoTKVL67k=","secondaryKey":"xNx7bJ/y5hH6q4oR5QCk7O2M2mkvdmQz2AIoTOsdSYY=","rights":"ServiceConfig, EnrollmentWrite, DeviceConnect"}]}
INFO: cli.azext_iot.common.base_discovery: Using policy 'provisioningserviceowner' for IoT Hub Device Provisioning Service interaction.
DEBUG: msrest.universal_http.requests: Configuring retry: max_retries=4, backoff_factor=0.8, max_backoff=90
DEBUG: msrest.service_client: Accept header absent and forced to application/json
DEBUG: msrest.http_logger: Request URL: 'https://rdrouin-dps.azure-devices-provisioning.net/enrollments/device1?api-version=2021-10-01'
DEBUG: msrest.http_logger: Request method: 'GET'
DEBUG: msrest.http_logger: Request headers:
DEBUG: msrest.http_logger: 'Accept': 'application/json'
DEBUG: msrest.http_logger: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: msrest.http_logger: 'x-ms-client-request-id': '014e9184-4d2e-11f0-a201-00155d9e4d8e'
DEBUG: msrest.http_logger: 'accept-language': 'en-US'
DEBUG: msrest.http_logger: 'User-Agent': 'python/3.12.9 (Linux-6.1.124.1-microsoft-standard-x86_64-with-glibc2.38) msrest/0.7.1 cloud-shell/1.0 msrest_azure/0.6.4 provisioningserviceclient/2021-10-01 Azure-SDK-For-Python IoTPlatformCliExtension/0.23.0'
DEBUG: msrest.http_logger: Request body:
DEBUG: msrest.http_logger: None
DEBUG: msrest.universal_http: Configuring redirects: allow=True, max=30
DEBUG: msrest.universal_http: Configuring request: timeout=100, verify=True, cert=None
DEBUG: msrest.universal_http: Configuring proxies: ''
DEBUG: msrest.universal_http: Evaluate proxies against ENV settings: True
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): rdrouin-dps.azure-devices-provisioning.net:443
DEBUG: urllib3.connectionpool: https://rdrouin-dps.azure-devices-provisioning.net:443 "GET /enrollments/device1?api-version=2021-10-01 HTTP/1.1" 200 848
DEBUG: msrest.http_logger: Response status: 200
DEBUG: msrest.http_logger: Response headers:
DEBUG: msrest.http_logger: 'Content-Length': '848'
DEBUG: msrest.http_logger: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: msrest.http_logger: 'Date': 'Thu, 19 Jun 2025 16:54:02 GMT'
DEBUG: msrest.http_logger: 'x-ms-request-id': 'c847f3a5-1380-49ff-b3fc-3c6608733413'
DEBUG: msrest.http_logger: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
DEBUG: msrest.http_logger: Response content:
DEBUG: msrest.http_logger: {"registrationId":"device1","registrationState":{"registrationId":"device1","createdDateTimeUtc":"2025-06-19T16:34:52.1690855Z","assignedHub":"rdrouin-hub2.azure-devices.net","deviceId":"device1","status":"assigned","substatus":"deviceDataMigrated","lastUpdatedDateTimeUtc":"2025-06-19T16:34:52.3343658Z","etag":"\u002213016373-0000-0100-0000-68543c2c0000\u0022"},"attestation":{"type":"symmetricKey"},"capabilities":{"iotEdge":false},"initialTwin":{"tags":{},"properties":{"desired":{"myvalue":1}}},"etag":"IjEzMDFjNjkzLTAwMDAtMDEwMC0wMDAwLTY4NTQ0MGEzMDAwMCI=","provisioningStatus":"enabled","reprovisionPolicy":{"updateHubAssignment":true,"migrateDeviceData":true},"createdDateTimeUtc":"2025-06-19T15:01:31.0356107Z","lastUpdatedDateTimeUtc":"2025-06-19T16:53:55.9805573Z","allocationPolicy":"static","iotHubs":["rdrouin-hub2.azure-devices.net"]}
DEBUG: msrest.service_client: Accept header absent and forced to application/json
DEBUG: msrest.http_logger: Request URL: 'https://rdrouin-dps.azure-devices-provisioning.net/enrollments/device1/attestationmechanism?api-version=2021-10-01'
DEBUG: msrest.http_logger: Request method: 'POST'
DEBUG: msrest.http_logger: Request headers:
DEBUG: msrest.http_logger: 'Accept': 'application/json'
DEBUG: msrest.http_logger: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: msrest.http_logger: 'x-ms-client-request-id': '0159e9bc-4d2e-11f0-a201-00155d9e4d8e'
DEBUG: msrest.http_logger: 'accept-language': 'en-US'
DEBUG: msrest.http_logger: 'User-Agent': 'python/3.12.9 (Linux-6.1.124.1-microsoft-standard-x86_64-with-glibc2.38) msrest/0.7.1 cloud-shell/1.0 msrest_azure/0.6.4 provisioningserviceclient/2021-10-01 Azure-SDK-For-Python IoTPlatformCliExtension/0.23.0'
DEBUG: msrest.http_logger: Request body:
DEBUG: msrest.http_logger: None
DEBUG: msrest.universal_http: Configuring redirects: allow=True, max=30
DEBUG: msrest.universal_http: Configuring request: timeout=100, verify=True, cert=None
DEBUG: msrest.universal_http: Configuring proxies: ''
DEBUG: msrest.universal_http: Evaluate proxies against ENV settings: True
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): rdrouin-dps.azure-devices-provisioning.net:443
DEBUG: urllib3.connectionpool: https://rdrouin-dps.azure-devices-provisioning.net:443 "POST /enrollments/device1/attestationmechanism?api-version=2021-10-01 HTTP/1.1" 200 250
DEBUG: msrest.http_logger: Response status: 200
DEBUG: msrest.http_logger: Response headers:
DEBUG: msrest.http_logger: 'Content-Length': '250'
DEBUG: msrest.http_logger: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: msrest.http_logger: 'Date': 'Thu, 19 Jun 2025 16:54:03 GMT'
DEBUG: msrest.http_logger: 'x-ms-request-id': '8a383963-5ad6-489c-9b9d-59152793c172'
DEBUG: msrest.http_logger: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
DEBUG: msrest.http_logger: Response content:
DEBUG: msrest.http_logger: {"type":"symmetricKey","symmetricKey":{"primaryKey":"tWAU2lQBhjs6RoRMXPvtKyuzDCK5A6L8mK3gtqypRQA5zfo2Ypte9PWGfm2VQ7QNkvvZOZ9IOvEaAIoT0vd6tQ==","secondaryKey":"UoZKgO/cqHHoJDa5OJLm4y7TcbvpVJEBJWPLYR7yNpApQbd9/afS85aYE/gRovvTDd4MIPyuozxqAIoTyfVCPA=="}}
DEBUG: msrest.service_client: Accept header absent and forced to application/json
DEBUG: msrest.http_logger: Request URL: 'https://rdrouin-dps.azure-devices-provisioning.net/enrollments/device1?api-version=2021-10-01'
DEBUG: msrest.http_logger: Request method: 'PUT'
DEBUG: msrest.http_logger: Request headers:
DEBUG: msrest.http_logger: 'Accept': 'application/json'
DEBUG: msrest.http_logger: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: msrest.http_logger: 'x-ms-client-request-id': '0164c06c-4d2e-11f0-a201-00155d9e4d8e'
DEBUG: msrest.http_logger: 'If-Match': '*'
DEBUG: msrest.http_logger: 'accept-language': 'en-US'
DEBUG: msrest.http_logger: 'Content-Length': '690'
DEBUG: msrest.http_logger: 'User-Agent': 'python/3.12.9 (Linux-6.1.124.1-microsoft-standard-x86_64-with-glibc2.38) msrest/0.7.1 cloud-shell/1.0 msrest_azure/0.6.4 provisioningserviceclient/2021-10-01 Azure-SDK-For-Python IoTPlatformCliExtension/0.23.0'
DEBUG: msrest.http_logger: Request body:
DEBUG: msrest.http_logger: {"registrationId": "device1", "attestation": {"type": "symmetricKey", "symmetricKey": {"primaryKey": "tWAU2lQBhjs6RoRMXPvtKyuzDCK5A6L8mK3gtqypRQA5zfo2Ypte9PWGfm2VQ7QNkvvZOZ9IOvEaAIoT0vd6tQ==", "secondaryKey": "UoZKgO/cqHHoJDa5OJLm4y7TcbvpVJEBJWPLYR7yNpApQbd9/afS85aYE/gRovvTDd4MIPyuozxqAIoTyfVCPA=="}}, "capabilities": {"iotEdge": false}, "initialTwin": {"tags": {}, "properties": {"desired": {"additional_properties": {"myvalue": 1}}}}, "etag": "IjEzMDFjNjkzLTAwMDAtMDEwMC0wMDAwLTY4NTQ0MGEzMDAwMCI=", "provisioningStatus": "enabled", "reprovisionPolicy": {"updateHubAssignment": true, "migrateDeviceData": true}, "allocationPolicy": "static", "iotHubs": ["rdrouin-hub1.azure-devices.net"]}
DEBUG: msrest.universal_http: Configuring redirects: allow=True, max=30
DEBUG: msrest.universal_http: Configuring request: timeout=100, verify=True, cert=None
DEBUG: msrest.universal_http: Configuring proxies: ''
DEBUG: msrest.universal_http: Evaluate proxies against ENV settings: True
DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): rdrouin-dps.azure-devices-provisioning.net:443
DEBUG: urllib3.connectionpool: https://rdrouin-dps.azure-devices-provisioning.net:443 "PUT /enrollments/device1?api-version=2021-10-01 HTTP/1.1" 200 765
DEBUG: msrest.http_logger: Response status: 200
DEBUG: msrest.http_logger: Response headers:
DEBUG: msrest.http_logger: 'Content-Length': '765'
DEBUG: msrest.http_logger: 'Content-Type': 'application/json; charset=utf-8'
DEBUG: msrest.http_logger: 'Date': 'Thu, 19 Jun 2025 16:54:03 GMT'
DEBUG: msrest.http_logger: 'x-ms-request-id': '0537d274-f8ef-4eff-95cc-800ba23e17c6'
DEBUG: msrest.http_logger: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
DEBUG: msrest.http_logger: Response content:
DEBUG: msrest.http_logger: {"registrationId":"device1","attestation":{"type":"symmetricKey","symmetricKey":{"primaryKey":"tWAU2lQBhjs6RoRMXPvtKyuzDCK5A6L8mK3gtqypRQA5zfo2Ypte9PWGfm2VQ7QNkvvZOZ9IOvEaAIoT0vd6tQ==","secondaryKey":"UoZKgO/cqHHoJDa5OJLm4y7TcbvpVJEBJWPLYR7yNpApQbd9/afS85aYE/gRovvTDd4MIPyuozxqAIoTyfVCPA=="}},"capabilities":{"iotEdge":false},"initialTwin":{"tags":{},"properties":{"desired":{"additional_properties":{"myvalue":1}}}},"etag":"IjEzMDFlZTkzLTAwMDAtMDEwMC0wMDAwLTY4NTQ0MGFiMDAwMCI=","provisioningStatus":"enabled","reprovisionPolicy":{"updateHubAssignment":true,"migrateDeviceData":true},"createdDateTimeUtc":"2025-06-19T15:01:31.0356107Z","lastUpdatedDateTimeUtc":"2025-06-19T16:54:03.6013271Z","allocationPolicy":"static","iotHubs":["rdrouin-hub1.azure-devices.net"]}
DEBUG: cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7f557775cb80>, <function _x509_from_base64_to_hex_transform at 0x7f557775cc20>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnFilterResult []
DEBUG: cli.knack.cli: Event: Cli.SuccessfulExecute []
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f55777089a0>]
INFO: az_command_data_logger: exit code: 0
INFO: cli.main: Command ran in 3.084 seconds (init: 0.539, invoke: 2.545)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 4130 in cache file under /home/rdrouin/.azure/telemetry/20250619165403795
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "/usr/bin/python3.12 /usr/lib/az/lib/python3.12/site-packages/azure/cli/telemetry/init.py /home/rdrouin/.azure /home/rdrouin/.azure/telemetry/20250619165403795"
INFO: telemetry.process: Return from creating process 4127
INFO: telemetry.main: Finish creating telemetry upload process.

Expected behavior

The initial twin properties should be left untouched by this query

Environment Summary

rdrouin [ ~ ]$ az --version
azure-cli 2.71.0 *

core 2.71.0 *
telemetry 1.1.0

Extensions:
account 0.2.5
ai-examples 0.2.5
azure-iot 0.23.0
ml 2.36.4
ssh 2.0.6

Dependencies:
msal 1.31.2b1
azure-mgmt-resource 23.1.1

Python location '/usr/bin/python3.12'
Config directory '/home/rdrouin/.azure'
Extensions directory '/home/rdrouin/.azure/cliextensions'
Extensions system directory '/usr/lib/python3.12/site-packages/azure-cli-extensions'

Python (Linux) 3.12.9 (main, Mar 11 2025, 15:30:57) [GCC 13.2.0]

Additional context

No response

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botIoTIoT/CLIService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions