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.
Asked
Active
Viewed 700 times
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 Sep 30 '19 at 04:23
-
The resources have been deployed through a separate deployment in a different resource group. @jarrad_obrien – Yituo Sep 30 '19 at 04:25
-
1How come the names of the existing resources can't be used as parameters in the new template? – jarrad_obrien Sep 30 '19 at 05:34
-
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_obrien – Yituo Sep 30 '19 at 17:31
-
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 Sep 30 '19 at 23:01
-
@Jarrad_obrien. I am trying to minimize these hard coded inputs in the deployment pipeline. Thank you for your suggestion, its a clean way to get around the question I asked. But listing with regular expression would still be a nice feature to have, especially for large scale deployment, could help avoid many human errors~ – Yituo Oct 01 '19 at 17:32
1 Answers
0
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:

AmanGarg-MSFT
- 1,123
- 6
- 10