Setting up a custom domain with an Azure Function app - azure

I have an Azure Function app running on dynamic pricing and am trying to set up a custom domain.
I have added and verified the domain and setup the CNAME record accordingly. The custom domain shows up correctly as the "URL" when I view the App Service settings in the Azure portal. If I try to use this domain, however (to access an HTTP trigger function), I am returned with "Error 404 - Web app not found."
When I look at the Function URL in the portal, it still shows the x.azurewebsites.net domain, not the custom domain I have added. Is there anything additional I need to do to get Functions working with a custom domain?

Copying from my answer on MSDN forum:
Indeed, custom domains are not yet supported for Dynamic Function plans. This support will come a bit later (no clear ETA to share at this point).

Thanks to #David Ebbo I figured out how to do this for a Function App running in a consumption plan (e.g. Y1). Here is the MSFT docs article:
https://learn.microsoft.com/en-us/azure/app-service/scripts/cli-configure-custom-domain
It seems that it cannot currently be done via the Azure Portal GUI and instead you must use Azure CLI to run the commands. It's easy to do directly from that article page using the "Try It" link to the embedded azCLI.

Related

How to set up Let's Encrypt with Azure? Trying to get SSL for my custom domain app service

I've tried following this:
https://www.youtube.com/watch?v=C6V_mBo-gnE
But the setup has changed, because you need some more properties now:
see more here: https://www.poppastring.com/blog/azure-lets-encrypt-dashboardconnectionstring-field-is-required
The property names does not fit the names in Azure either, so more confusion for me.
Is it possible to just do this from the certify client? I managed to do this for Godaddy, but the DNS Update Method "Azure DNS API" is also confusing..
Sorry I can only find old guides for this..
Both of these should be set to your Azure Storage Account connection string, e.g. DefaultEndpointsProtocol=https;AccountName=[myaccount];AccountKey=[mykey];
Please see Scott's post here for complete instructions on using the Let's encrypt extension with Azure Web Apps.:
https://www.hanselman.com/blog/securing-an-azure-app-service-website-under-ssl-in-minutes-with-lets-encrypt

How to programmatically update Networking Access Restriction on Azure Web App

I have an Azure webapp and normally if I want to block an IP address, I go to Azure dashboard panel and under networking>Configure Access Restrictions, I add a rule to do so. This picture shows which menu item I mean:
However, I would like to do this programmatically. I see that the documentation shows how you can do this through Powershell.
I have also managed to find the API documentation for WebApp. But I can't find the last piece of the puzzle which is the API that does what I need.
Can someone please tell me if it is possible and which API I should use? Thank you in advance.
According to the doc: Use an Azure REST API PUT operation on the app configuration in Azure Resource Manager. The location for this information in Azure Resource Manager is:
management.azure.com/subscriptions/subscription ID/resourceGroups/resource groups/providers/Microsoft.Web/sites/web app name/config/web?api-version=2020-06-01
Then I searched the Azure Rest API and found this:
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/web?api-version=2019-08-01
We could update the field properties.ipSecurityRestrictions to update the value of Access Restrictions.
In addition, you could also check this blog: Bulk add IP Access Restrictions to Azure App Service using Az PowerShell
There does not appear to be a one-to-one match between powershell commands and api.
The closest I could find is:
https://learn.microsoft.com/en-us/rest/api/appservice/webapps/putprivateaccessvnet
This allows you to define which vnet has access to your web app. By controlling access to your vnet, you can control access to your app.

Issue mapping custom domain to Azure Web App

I own a domain name and am trying to map it to an Azure Web App that I successfully created.
I created an A record, C record, and Txt (as required by Azure) on Godaddy and configured Custom Domains in Azure (as pictured below). The message I'm getting back now is:
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
Any suggestions?
By looking in https://www.digwebinterface.com/
https://www.digwebinterface.com/?hostnames=dnnappserver.scm.azurewebsites.net%0D%0Asmarttapp.com%0D%0Awww.smarttapp.com&type=&ns=resolver&useresolver=8.8.4.4&nameservers=
Everything seems perfect and even mapping is correct. Even site are working by custom domain :)

Azure Traffic Manager support with Azure Function Apps

I am trying to use Azure Traffic Manager (GTM) to geographically distribute load to function apps in each region.
I have tried adding an 'app service endpoint' and an 'external endpoint' (including adding the GTM name as a custom CNAME to the function app), but both result in "Error 404 - Web app not found.". The custom CNAME also never adds correctly.
According to the last comment on this post, the ability to do this should now be supported:
Setting up a custom domain with an Azure Function app
I am unable to comment back on the post as I am a new user.
I have tried adding an 'app service endpoint' and an 'external endpoint' (including adding the GTM name as a custom CNAME to the function app)
Azure Traffic Manager is only eligible for use with App Services at the 'Standard' level or above as mentioned here. If your function isn't host in an app plan at the 'Standard' level or above, Azure Traffic Manager will not work.
If you are not using 'Standard' or higher level app plan, Azure Functions Proxies would be a workaround for you. Please check following thread which discuss the similar problem.
Azure Functions Traffic Manager
Here is the quick reference from the answer provided by Dakota Kincer.
So the answer I arrived to after Traffic manager didntsupport Azure functions was to overall build 3 Azure functions. I built an East and a West that has my azure function code on it. Then I built a main Azure Function that has 0 code. It only has Azure proxies on it that route to my 2 other Azure Functions. The route is controlled by a variable in the proxy string that is help in the main API app settings. Using %myvariable% you can set part of the url. When I need to publish I switch the variable to the secondary URL location. Update the Primary and then switch the URL to its original primary location. This will have to work for now till traffic manager is integrated into functions or a better solution arises.
I am unable to comment back on the post as I am a new user.
You could modify your post if you want to provide more information.
Traffic Manager supports Azure functions monitoring. You can enable this by going to TM settings -> endpoints -> add endpoint -> choose Azure endpoint type -> App Service for Target resource type -> under Target Resource choose Function app which you want to monitor.
Most likely you want to be able to access function apps under specific domain domain, for example my-domain.com. For that under Custom Header Settings specify host:my-domain.com. You'll need to setup custom domain in function apps configuration too.

Two Azure Cloud Services Single Domain

In IIS you can create an Application on a site so now I want to try and accomplish the same on Azure Cloud Service:
tenant.mysite.com - One Cloud Service
tenant.mysite.com/api - Another Cloud Service
The reason I want it done like this is cause this is a multi-tenant site and the api needs to be called with the tenants URL.
Is there any way out the box to do this with Azure? Am I looking at the whole solution wrong or do I have to look into doing a proxy of sorts?
I did host the application similar to what you have did.
There are a few points that you will need to take care of
1. Overlapping sections of web.config file should be locked using <location path='.'.... > tags
2. Proper references for the dlls to be given
This is easily achieved in both the Azure websites and Azure Cloud Services. The link that explains how you can get started is given below. Post questions if you have tried this and run into some issues.
http://blogs.msdn.com/b/tomholl/archive/2014/09/22/deploying-multiple-virtual-directories-to-a-single-azure-website.aspx

Resources