'Azure Policy DeployIfNotExist conditional

I need to create a DINE policy, but it has to deploy different resources depending on the region.

For example: If I am deploying in West Europe, I need to "DeployIfNotExist" a resource in West Europe. If I am deploying in East US 2, I need to "DeployIfNotExist" a resource in East US 2.

Scenario: I am adding to the diagnostic settings of Azure SQL, a link to EventHub (which is already existing in weu or eus2)

Is that possible todo?

** I know we can create two policies with the existing condition checking the region, but I am looking for a solution to do it in a single policy. **



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source