How does one refer to Diagnostic Settings? Let's s...
# azure
p
How does one refer to Diagnostic Settings? Let's say I need to import an existing one to Pulumi. In Azure Portal, you can't see its URI anywhere, so I'm not sure what I should pass to the import command.
t
You should be able to see an example of ID in the docs. I don’t know which exact resource you mean but here is a guess: https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/diagnosticsetting/#import
l
⤴️ In such situations, I've had to synthesize the URI from the example in the
import
docs for the resource types, e.g. https://www.pulumi.com/registry/packages/azure-native/api-docs/insights/diagnosticsetting/#import
p
Thanks guys, but that example is wrong (I figured it out in the meantime with the help of the Resource Manager API docs). The example URI has this form:
Copy code
{resourceUri}/diagnosticSettings/mysetting
but this fails with
Copy code
error: Preview failed: autorest/azure: Service returned an error. Status=400 Code="NoRegisteredProviderFound" Message="No registered resource provider found for location 'global' and API version '2017-05-01-preview' for type 'frontdoors'. The supported api-versions are '2018-08-01, 2019-04-01, 2019-05-01, 2019-08-01, 2020-01-01, 2020-04-01, 2020-05-01, 2020-07-01, 2021-06-01'. The supported locations are 'global, centralus, eastus, eastus2, northcentralus, southcentralus, westus, northeurope, westeurope, eastasia, southeastasia, japaneast, japanwest, brazilsouth, australiaeast, australiasoutheast'."
Instead, the URI should be
Copy code
{resourceUri}/providers/microsoft.insights/diagnosticSettings/mysetting
I tried with Diagnostic Settings on a SQL Database and a Front Door so far.