Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.38k stars 2.71k forks source link

DeviceProvisioningClient client.enrollment_group.create_or_update throws ResourceExistsError #35187

Open Gamecock opened 3 months ago

Gamecock commented 3 months ago

Describe the bug Trying to update an existing group enrollment creates a azure.core.exceptions.ResourceExistsError:

To Reproduce Steps to reproduce the behavior:

  1. Create a symetric Key enrollment using enrollment group
  2. edit the enrollment group definition to change something (for example iotHubs)
  3. Run again
  4. Exception

Expected behavior Enrollment Group to reflect new properties. Screenshots

Additional context Sample Code

DPS_ENDPOINT = environ.get("DPS_ENDPOINT")
aad_credentials = DefaultAzureCredential()
# Create client using endpoint and credential
client = DeviceProvisioningClient(endpoint=DPS_ENDPOINT, credential=aad_credentials)

symmetric_enrollment_group_ids = ["MyGroup"]

for group in symmetric_enrollment_group_ids:
    enrollment_group = {
        "enrollmentGroupId": group,
#        "iotHubs": hostnames,
        "attestation": {
            "type": "symmetricKey"
        }
    }

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

`

xiangyan99 commented 3 months ago

Thanks for the feedback, we’ll investigate asap.