Create Azure IoT using ARM Template in Azure

0 votes

I'm trying to execute automated script generated from Azure for iothub end points, but getting the following the error:

New-AzureRmResourceGroupDeployment : 12:25:25 AM - Error: 
Code=InvalidTemplate; Message=Deployment template validation failed: 'The 
template resource 'ServiceBus1/Topic1/iothubroutes_tst-IOTHUB' at line '216' 
and column '10' is not valid: Unable to evaluate template language function 
'resourceId': function requires exactly one multi-segmented argument which 
must be resource type including resource provider namespace. Current function 
arguments 'Microsoft.ServiceBus/namespaces/topics,ServiceBus1/Topic1'. Please 
see https://aka.ms/arm-template-expressions/#resourceid for usage details.. 
Please see https://aka.ms/arm-template-expressions for usage details.'.
At C:\Users\user\Desktop\testEndpoints\CIMS-ResourceGrp\deplo
y.ps1:104 char:5
+     New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGr ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeplo 
   yment], Exception
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets 
   .Implementation.NewAzureResourceGroupDeploymentCmdlet

Please find below is the template file piece of code:

"enableExpress": false
        },
        "dependsOn": [
            "[resourceId('Microsoft.ServiceBus/namespaces', parameters('namespaces_CS_ServiceBus_name'))]"
        ]
    },
    {
        "comments": "Generalized from resource: '/subscriptions/7dshsjdh/resourcegroups/CS-ResourceGrp/providers/Microsoft.ServiceBus/namespaces/CS-ServiceBus/topics/cs-topic/authorizationRules/iothubroutes_Cs-IOTHUB'.",
        "type": "Microsoft.ServiceBus/namespaces/topics/authorizationRules",
        "name": "[parameters('authorizationRules_iothubroutes_CS_IOTHUB_name')]",
        "apiVersion": "2015-08-01",
        "location": "East US",
        "scale": null,
        "properties": {
            "rights": [
                "Send"
            ]
        },
        "dependsOn": [
            "[resourceId('Microsoft.ServiceBus/namespaces', parameters('namespaces_CS_ServiceBus_name'))]",
            "[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('topics_cs_topic_name'))]"
        ]
Sep 5, 2018 in IoT (Internet of Things) by Matt
• 2,270 points
1,362 views

1 answer to this question.

0 votes

It is not recommended to deploy the ARM template which is generated from Azure portal directly. Because the ARM template which you copied from Azure portal will contains all the resources in the current resource group and parts of your resources can't be exported to the template.

To create an IoT hub using Azure Resource Manager template, I suggest you use the template included in following article.

Create an IoT hub using Azure Resource Manager template (PowerShell)

answered Sep 5, 2018 by anonymous2
• 4,240 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Publishing commands to device in IBM IoT using MQTT in Java

If you are publishing from an application, ...READ MORE

answered Jul 27, 2018 in IoT (Internet of Things) by anonymous2
• 4,240 points
1,506 views
0 votes
1 answer

SQLite.Net not being able to create text file in Win IoT Library!

That exception comes when access limited to ...READ MORE

answered Aug 3, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,003 views
0 votes
1 answer

Using FIWARE to start Cygnus as a Service in IoT Solution

Cygnus is supposed to create /var/run/cygnus/ when started. You ...READ MORE

answered Aug 13, 2018 in IoT (Internet of Things) by anonymous2
• 4,240 points
939 views
0 votes
1 answer

Using Sleep()/Delay() in C# on Windows IoT

You'll be glad to know that C# ...READ MORE

answered Aug 28, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
2,263 views
0 votes
1 answer

Displaying Table Schema using Power BI with Azure IoT Hub

Answering your first question, Event Hubs are ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,310 views
0 votes
1 answer

How to use the data I receive from Azure IoT Hub?

The payload you receive will be a ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
1,808 views
0 votes
1 answer

Azure - What service to use for Arduino data (iot)

That's because the two services do completely ...READ MORE

answered Aug 1, 2018 in IoT (Internet of Things) by anonymous2
• 4,240 points
1,056 views
0 votes
2 answers

Azure IoT Hub Operations Monitoring

Hi, Can you tell which device you ...READ MORE

answered Jan 4, 2019 in IoT (Internet of Things) by Varul
• 140 points
1,682 views
0 votes
1 answer

Control LED Blinking Using Java in Azure IoT Hub

Your description of what you did is ...READ MORE

answered Sep 5, 2018 in IoT (Internet of Things) by anonymous2
• 4,240 points
981 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP