Closed gregjhogan closed 5 years ago
@rjmax @ravbhatnagar Do you guys know the answer to this one?
I don't think this is currently supported for nested types. @rjmax to confirm and see if we can address this.
I think I figured this out:
[resourceId('resource-group','Microsoft.Network/virtualNetworks/subnets','test-vnet','default')]
funny how none of the quick-start examples do this
@gregjhogan Oh my days! This solved my problem exactly with referencing an existing subnet! Thank you so much!
Experienced this same behavior when working with Service Bus, Event Hubs & SAS Policies. @gregjhogan's suggestion above worked nicely. It would be nice if resourceId()
worked either way, e.g.:
resourceId([sub], [resource_group], type, resource_path)
ORresourceId([sub], [resource_group], type, resource1, resource2, ...)
where resource_path
above is a multi-segement string separated by slashes, e.g. parent/child
.
I also have a similar problem but unable to understand how to implement the solution.
I am getting this error when trying to deploy my Azure Resource Package. Would love to find a way around 'resourceId': function requires exactly one multi-segmented argument statement.
[ERROR] New-AzureRmResourceGroupDeployment : 2:17:06 PM - Error: Code=InvalidTemplate;
14:17:06 - [ERROR] Message=Deployment template validation failed: 'The template resource
14:17:06 - [ERROR] 'xxxxx/basket-item-changed-topic/basket-telemetry-processor' at line
14:17:06 - [ERROR] '2799' and column '10' is not valid: Unable to evaluate template language
14:17:06 - [ERROR] function 'resourceId': function requires exactly one multi-segmented argument
14:17:06 - [ERROR] which must be resource type including resource provider namespace. Current
14:17:06 - [ERROR] function arguments 'Microsoft.ServiceBus/namespaces/topics,xxxxxx/bask
14:17:06 - [ERROR] et-item-changed-topic'. Please see
-------------------This is the template
{ "comments": "Generalized from resource: '/subscriptions/fa17ed69-d83f-47bc-8604-fd96cd27d322/resourcegroups/xxxxxxx-Integration-Environment/providers/Microsoft.ServiceBus/namespaces/xxxxx/topics/basket-item-changed-topic/subscriptions/basket-telemetry-processor'.", "type": "Microsoft.ServiceBus/namespaces/topics/subscriptions",
"name": "[parameters('subscriptions_basket_telemetry_processor_name')]",
"apiVersion": "2015-08-01", "location": "UK West",
"scale": null, "properties": {
"lockDuration": "00:02:00", "requiresSession": false,
"defaultMessageTimeToLive": "10675199.02:48:05.4775807",
"deadLetteringOnMessageExpiration": true,
"deadLetteringOnFilterEvaluationExceptions": true,
"messageCount": 0, "maxDeliveryCount": 1,
"enableBatchedOperations": true, "status": "Active",
"createdAt": "2017-05-10T14:31:54.2059078Z",
"updatedAt": "2017-05-10T14:31:56.6330818Z",
"accessedAt": "2017-06-23T10:53:20.3815084Z",
"countDetails": { "activeMessageCount": 0,
"deadLetterMessageCount": 0,
"scheduledMessageCount": 0, "transferMessageCount": 0, "transferDeadLetterMessageCount": 0
}, "autoDeleteOnIdle": "10675199.02:48:05.4775807",
"entityAvailabilityStatus": "Available" },
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', parameters('namespaces_xxx_int_name'))]",
"[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('topics_basket_item_changed_topic_name'))]" ]
},
@rifaterdemsahin have you considered adding the topic as a resource of the namespace, rather than stating "depends on"? There is a "resources" property that you can set on the namespace, you should consider putting the topic within this, rather than having the topic outside, then referencing the namespace by using the "depends on" property. HTH. Padda
Hi All,
I'm trying to add new certificate to already existing secured ServiceFabric Cluster (old certificate will expire in one week) based on this article - https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-security-update-certs-azure
During the template test "Test-AzureRmResourceGroupDeployment" -
PS C:> Test-AzureRmResourceGroupDeployment -Mode incremental -ResourceGroupName SF-ResGroup01 -TemplateFile C:\azuresf\sf_template.json -TemplateParameterFile C:\azuresf\sf_parameters.json
Code : InvalidTemplate Message : Deployment template validation failed: 'The template resource 'sfnode02' at line '110' 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.Network/virtualNetworks/subnets,VNet-lk-sf02/Subnet-0'
?
Regards LuuuK
I had somewhat of a similar error: "the type 'Microsoft.Logic/integrationAccounts/schemas' requires '2' resource name argument(s)" while attempting to add a depends to an partner agreement which relied upon a schema in the integration account.
The solution looked like this: "dependsOn": [ "[parameters('IntegrationAccountName')]", "[resourceId('Microsoft.Logic/integrationAccounts/schemas',parameters('integrationAccountName'), 'X12_00401_850')]" ]
note: X12_00401_850 was the name of the schema, in the real world I would not hard code this, this was for a POC.
I hope this saves someone some time.
I'm having this error for a resouce with 3 parts in the name:
I have a resource of type "Microsoft.ApiManagement/service/diagnostics/loggers", and name "[concat(parameters('apimanagementname'), '/applicationinsights/applicationinsightsLogger')]",
I have tried to fetch this with:
- [resourceId('Microsoft.ApiManagement/service/diagnostics/loggers', parameters('apimanagementname'), 'applicationinsights/applicationinsightsLogger')]",
- [resourceId('Microsoft.ApiManagement/service/diagnostics/loggers', concat(parameters('apimanagementname'), '/applicationinsights/applicationinsightsLogger'))]
both are not working. Any other ideas?
I think the resource reference design in ARM templates is frankly insane, given that we could just uniquely label them and refer by label.
should have closed this a long time ago, the solution is in my first comment: https://github.com/Azure/azure-quickstart-templates/issues/1965#issuecomment-233241222
I think I figured this out:
[resourceId('resource-group','Microsoft.Network/virtualNetworks/subnets','test-vnet','default')]
funny how none of the quick-start examples do this
If the VirtualNetwork is in the same ResourceGroup we could omit it, for example:
"[resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnetName', 'subnetName')]"
The reason behind is that the resourceId method defaults to its current resource group
Seems like it is more difficult that it should be to reference a subnet using the resourceId() function.
Attempting to specify
Fails with the error
Am I missing something? Obviously I can get the resource ID of the vnet, then use concat to add on the subnet, but it seems like resourceId() should support this. I am guessing subnets are not the only resource type like this. Can't the first multi-segment parameter be identified as the resource type, and then allow either sub-resources to be multi-part (or allow more than two resourceName trailing parameters which are concatentated with separating slashes)?