1
votes

I wonder if there is a way to get a resourceId with name that matches a regular expression in another subscription. The reason is that during deployment a random postfix is generated and appended to resource name, so resource name is not known beforehand. I know the resourceId() function could give you the resource Id if the resource name is known.

1
When using resourceId(), is the resource being deployed as part of the same template, or has it already been deployed beforehand as a completely separate deployment?jarrad_obrien
The resources have been deployed through a separate deployment in a different resource group. @jarrad_obrienYituo
How come the names of the existing resources can't be used as parameters in the new template?jarrad_obrien
Its because the resource name are generated during deployment, and not known beforehand. I think there are ways to get around the question I asked, its just not as clean. @jarrar_obrienYituo
I mean that in the second template, how come you can't create a parameter such as namesOfExistingResources and populate it with the existing resources? e.g. namesOfExistingResources: ['myResource2834', 'myResource7482']jarrad_obrien

1 Answers

0
votes

You can achieve this by using the output of the previous template as input to the new template:

Azure ARM templates - using the output of other deployments

Here is how to achieve this in Azure DevOps:

How do I use ARM 'outputs' values another release task?