IOTHub - Proper error message not shown when sku is missing while creating a new IotHub using New-AzureRmResource
Hi,
Am trying to create IOTHub with the following command. Please look into the same.
New-AzureRmResource -ResourceName "IotHubSample1" -ResourceType Microsoft.Devices/Iothubs -ResourceGroupName Poc -Location "East US" -Properties @{ Location="East US"}
Confirm Are you sure you want to create the following resource: /subscriptions/xxxxxxxxxxxx/resourceGroups/Poc/providers/Microsoft.Devices/Iothubs/IotHubSample1 [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y New-AzureRmResource : The pipeline has been stopped. At line:1 char:1
- New-AzureRmResource -ResourceName "IotHubSample1" -ResourceType Microsoft.Device ...
-
- CategoryInfo : CloseError: (:) [New-AzureRmResource], PipelineStoppedException - FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet
New-AzureRmResource : A task was canceled. At line:1 char:1
- New-AzureRmResource -ResourceName "IotHubSample1" -ResourceType Microsoft.Device ...
-
- CategoryInfo : CloseError: (:) [New-AzureRmResource], TaskCanceledException - FullyQualifiedErrorId : A task was canceled.,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet
Thanks, Pradebban Raja
@Pradebban - If I specify a Sku for the IOT hub, the hub gets created successfully. New-AzureRmResource -ResourceName IotHubSample111 -ResourceType Microsoft.Devices/IotHubs -ResourceGroupName test111 -Location EastUs -Properties @{Location="EastUS"} -SkuObject @{name="s1"; tier="standard"; capacity="1"} -Debug
@ravbhatnagar - Thanks, But the error is misleading and has no mention that the -SkuObject missing
Agreed that the error message is not helpful. I will see what we can do to improve in this scenario. II will update the title to accurately reflect what needs to be fixed.
More info - SkuObject is not a required parameter and so the cmdlet does not fail for that reason. It happens that the Sku seems to be required when creating a resource of this type. In most cases we should return the error we get back from the resource provider. It looks like an issue of the resource provider not giving back an appropriate error message. We will investigate.
@tianoMs - please see if we can improve the message in this case? Why is it showing a Task was cancelled message. Are we not getting a better error from the RP?
Fixed for July release
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @rthorn17