I currently have a situation where i'm deploying 2 App Services into a new App Service Plan together.
Both App Services use the same certificate - *.test.myapp.internal
The App Services must be deployed independently of one another.
Right now, both have the exact same ARM Template resource code to deploy a Microsoft.Web/certificates resource with them, and link it to the hostnamebinding.
I deployed the first app service, and all went smoothly, my certificate was read from a keyvault, and copied to the resource group of the first application. The application was then able to use the certificate, and worked well.
Next, i went to deploy the second app service, which also lives in it's own resource group. This time i was met with an error message stating that there's a conflict with the certificate resource, and that a certificate with that thumbprint already exists.
Another certificate exists with same thumbprint xxxx in xxxx... etc.
I'm running my ARM Template in the Create or Update mode (Incremental) - so i would assume that as i'm supplying the exact same name for the certificate in both templates - and therefore it exists already, it would just be skipped.
So - how can I skip the certificate resource being created? Clearly it exists, and i could use it with the second App Service. As far as i can tell, there's no "exists" style function in ARM.
EDIT: Had an idea where I can set a parameter and do conditional logic on whether to deploy that resource or not. However, i'm not sure that works when i have the "dependsOn" part set for other resources. i.e. the site or hostnamebinding depending on the cert to be deployed. Guess i've got some testing to do.