I am deploying an Azure API management app through an ARM template. As a part of my requirement, I need to retrieve the static web app default domain to configure APIs to receive requests through an ARM template.
For now, I am doing manually by following below link, but I need to automate same kind of steps through ARM template deployment.
we can fetch azure function app default key using below script, which is something similar I am looking for same to retrieve static web app custom domain name.
listKeys(concat(resourceId(variables('functionSite-ResourceGroup'),'Microsoft.Web/sites', 'FunctionTestAppName'), '/host/default'), '2016-08-01').functionKeys.functionKeys.default
Firstly, retrieval of default custom domain value from a static web site is not directly doable as the communication between custom domains and web sites will be managed externally. You can use either
PowerShellorCLIto retrieve the default value easily using related commands.CLI:
PowerShell:
If your requirement is still with the ARM template, then you can follow the workaround given below.
You can pass the above
PowerShellorCLIcommands directly to the deployment scripts in ARM template and reference the template later in theoutputsblock.Refer MSDoc to check how to link the templates in
outputsblock.Another alternative is to set the default custom domain value as a user defined value in the
parametersblock and retrieve it in theoutputsblock by referencing that relatedparameter.I tried a sample template for the above workaround by referring to the github template and was worked as follows.