Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to retrieve the oms workspace id inside my ARM template

I create an oms workspace through ARM templates and deploy them to azure through azure devops. Because I have an automated mindset I also deploy the virtual machine ARM through azure devops.

Because I don't want to deploy the OMS workspace and go to the portal and copy the workspace id to paste this in the arm template parameters of the virtual machine to point the VM extension to the right workspace.

My question now is if it is possible to connect these 2 in 1 deployment to deploy an oms workspace and export the workspace id to the vm arm deployment.

So that I skip the manual step and automate the entire deployment.

Source: I found a fellow automate thinking guy but there was no right answer on his question. https://github.com/MicrosoftDocs/azure-docs/issues/13787

Does anyone have any clue if this is possible I searched and not found any way to do this atm.

like image 716
achahbar Avatar asked Dec 13 '18 15:12

achahbar


People also ask

How do I use existing resources in arm template?

To modify existing resources using ARM templates, export the template for the resource from within the Azure Portal. Then download it locally. You can then modify it to update settings for Cosmos resources. ARM templates have api-versions.

Where are arm templates stored in Azure?

This will allow for the template to be manually changed or saved somewhere for it to be retrieved for later use. When Saving, the ARM Template will be saved to a collection accessible from “Browse > Templates” within the Azure Portal.

What is ResourceID in arm template?

When referencing other resources in ARM Templates, we need to provide their unique identifier to locate the resource. Using the ResourceID function we can provide a few pieces of information and retrieve the resource ID of any given resource. The function is simple to use.


1 Answers

you can use reference() function to achieve that:

"[reference(resourceId('Microsoft.OperationalInsights/workspaces', 'workspaceName'), '2017-03-15-preview').customerId]"

https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#reference

like image 155
4c74356b41 Avatar answered Nov 02 '22 05:11

4c74356b41