Azure/azure-sdk-for-python

enrollment_group.create_or_update ignores default

Gamecock opened this issue · 2 comments

Package Name: azure.iot.deviceprovisioning
Package Version: 1.0.0.b1
Operating System: Windows10
Python Version: 3.11.1

Describe the bug
Specifying iotHub without allocation policy throws
azure.core.exceptions.HttpResponseError: (400004) Enrollment allocationPolicy must be specified when iotHubs are specified.
To Reproduce
Steps to reproduce the behavior:
Run code below with hostnames populated

Expected behavior
Group created using default evenlyWeighted allocationPolicy

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Code Sample. Same code as #35187 used to work, but now throws.

# Create service client for enrollmemt groups using endpoint and credential
client = DeviceProvisioningClient(endpoint=URI, credential=aad_credentials)

group = "mygroup"

enrollment_group = {
    "enrollmentGroupId": group,
    "attestation": {
        "type": "symmetricKey"
    },
    "iotHubs": hostnames

}
client.enrollment_group.create_or_update( id=group, enrollment_group=enrollment_group)

Adding "allocationPolicy": "Hashed" to the enrollment_group resolves, but it not in any examples.

Thanks for the feedback, we’ll investigate asap.