Azure/azure-iot-cli-extension

[Technical Question] Create Azure IoT Hub with turned-on preview mode

bastyuchenko opened this issue · 2 comments

I need to create an Azure IoT Hub through my deployment pipeline with turned-on preview mode. In the pipeline, I use az iot hub create cli but I cannot find any option to create Azure IoT Hub in preview mode.

Hey @bastyuchenko - you are correct, there is not currently a parameter in iot hub create to specify features like Preview Mode on create.

I'll create a task on our end to discuss adding this as a CLI parameter on create.

However, you should still be able to use ARM template deployments to create preview hubs:

  • First, create your deployment template JSON file with properties.features = "GWV2"

Here's an example JSON file, you can either create a barebones one like this below (just change your hub name, location, and SKU) or use the portal UI to export a template for automation:

{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
    "contentVersion": "1.0.0.0",
    "resources": [
        {
            "apiVersion": "2023-06-30-preview",
            "type": "Microsoft.Devices/IotHubs",
            "name": "[your_hub_name]",
            "location": "centralus",
            "properties": {
                "features": "GWV2"
            },
            "sku": {
                "name": "S1",
                "capacity": 1
            }
        }
    ]
}
  • Then you should be able to deploy it to a specific resource group with:
    az deployment group create -g resource_group --template-file ./path-to.json

Closing due to inactivity, if the provided solution isn't a sufficient workaround please let me know and we can re-open.