Closed Agular closed 10 months ago
I managed to recreate the issue by creating an event hub endpoint with no resource group or subscription id - meaning that the endpoint was created not using the CLI or the portal (both auto populate the fields). This does create some broken behavior (unable to update the endpoint properties in portal).
In this scenario, the state command should drop this eventhub since there is no simple way to check if the event hub still exists and retrieve the most recent connection string (due to the missing resource group). We plan to add some custom error handling flags in the future to let you ignore these kinds of errors and keep these kinds of endpoints.
I will double check the other endpoint types for the same issue.
@vilit1 So I checked also and noticed that our EventHub was created via Terraform and saw that our script did not fill in the resource group which is optional there. Fixed it in our script, updated the EventHub and now the iot hub state export succeeded.
Alright - I made a pr to make state a bit more robust in these kinds of scenarios: https://github.com/Azure/azure-iot-cli-extension/pull/684
I will close this issue since you resolved it but if you have any other questions (or issues), feel free to create a new issue
Describe the bug Running the command az iot hub state export ends up with an error in one of the azure-iot providers python script file, state.py .
Error returned from command:
I've traced this back to how the ARM template is fetched via
az group export
on line 249 in the state.py file. On line 692, the eventHub endpoints are looped over and the script tries to access the resourceGroup property of the eventHub.The problem is that the eventHub does not contain a resourceGroup property in the response and therefore fails. I've checked the event hub in question in Azure portal and I see that it has a resource group just fine in the UI
So either the az group export returns incomplete data about the Iot Hub, the script needs to be fixed or creation of the Event Hub went wrong / was buggy.
To Reproduce Steps to reproduce the behavior:
Expected behavior Iot Hub is correctly exported
Screenshots
Environment (please complete the following information):