How can I extract an Azure resources ID as a strin...
# dotnet
How can I extract an Azure resources ID as a string? I have created a new AppService which has an ID property in the form of Output<string>. I want to use the ID of this AppService object to call the Pulumi.Azure.Monitoring.Invokes.GetDiagnosticCategories method in order to get a list of the supported monitoring categories so I can enable them all. To call GetDiagnosticCategories I need to pass in a GetDiagnosticCategoriesArgs which has a single property of ResourceId as a string (not Output<string> so if I try and pass in myAppService.ID it errors. Is there a way to achieve this?
You need to use `.Apply()`:
Copy code
app.Id.Appply(id => 
  var b = GetDiagnosticCategories(;
Thanks @tall-librarian-49374. Am I right in thinking that the Apply will return another Output<> containing the logs types? I can see that would let me iterate through them but s there a way to print them out to the console just so I can see what options are available?
Yes, it’s outputs all the way. Once you get an output, you have to do everything with
So, your printing has to be inside
too. Alternatively, if you have e.g.
, you can also save it to stack outputs and they will be printed after
pulumi up
is done.
Makes sense, thanks!