Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated dependsOn resource ID is invalid when using web app certificates/custom domains #897

Open
mike-wade opened this issue Mar 14, 2022 · 0 comments

Comments

@mike-wade
Copy link
Contributor

Copied from comments on #846

It appears that in the ARM template the generated dependsOn resource ID is invalid when using web app certificates.

 "apiVersion": "2020-10-01",
              "dependsOn": [
                "[resourceId('[resourceGroup().name]', 'Microsoft.Resources/deployments', '[concat(resourceGroup().name,'-deployment-1115')]')]"
              ],
              "name": "[concat(resourceGroup().name,'-deployment-1116')]",

I believe that
[resourceId('[resourceGroup().name]', 'Microsoft.Resources/deployments', '[concat(resourceGroup().name,'-deployment-1115')]')]
Should actually be
[resourceId(resourceGroup().name, 'Microsoft.Resources/deployments', concat(resourceGroup().name,'-deployment-1115'))]

I haven't shown the full JSON for the ARM template but the deployment with the problem contains a hostname binding deployment-1116 and deployment-1115 contains the certificate.

To reproduce it exactly you need to make 2 new RG's dns_test & mw_test as well as a DNS zone farmer.com in the dns_test RG.

open Farmer
open Farmer.Builders

let webAppConfig =
    webApp {
        name $"test"
        sku Farmer.WebApp.Sku.S1
        custom_domain "test.farmer.com"
    }

let dnsCname =
    cnameRecord {
        link_to_unmanaged_dns_zone (Farmer.Arm.Dns.zones.resourceId "farmer.com")
        name "test"
        ttl 3600
        cname $"famertest.azurewebsites.net"
    }

let clientArmDeployment =
    resourceGroup {
        name "mw_test"
        location Location.CentralUS
        add_resources [ webAppConfig ]
    }

let dnsDeployment =
    resourceGroup {
        name "dns_test"
        location Location.CentralUS

        add_resource dnsCname
    }

arm {
    add_resources [ clientArmDeployment
                    dnsDeployment ]
 } |> Writer.quickWrite "abc123json"

Then run the following PowerShell command New-AzSubscriptionDeployment -TemplateFile ./abc123json.json -Location westeurope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant