Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure Azure Function access restrictions to allow for testing via portal

I've got my Azure function app set to restrict access to just the APIM public IP and my desktop IP. I seem though to be unable to test the function within the portal itself (i.e. going to MyFunctionAppName > TestFunction > Code + Test > Test/Run) as I get an error saying "You must have direct network access in order to run your function. Your app may be restricted with Private Endpoints, Access Restrictions or Service Endpoints." I'm not sure if there's an IP I need to add or something else to let me test via the portal itself.

like image 566
Architekt Avatar asked Oct 19 '25 13:10

Architekt


2 Answers

Just figured this out for myself. Go to the Function App > Networking > Access Restriction > Check Allow Public Access > Add a rule. When you're adding the rule, change the type to Service Tag and select AzureCloud for the Service Tag. Save the rule and it should work now. Like Elthan said...

This whitelists all datacenter public IPs, which will allow you to use the Test/Run feature through the Azure Portal again

like image 75
user21812735 Avatar answered Oct 22 '25 04:10

user21812735


I was struggling with the same thing after adding VNets. The issue is as mentioned earlier that the requests originate from an Azure IP, a list of them can be found here. As you can see from the link, it's a lot of possible IPs and they frequently change. What I found however is that you can now whitelist a Service Tag named AzureCloud. This whitelists all datacenter public IPs, which will allow you to use the Test/Run feature through the Azure Portal again.

like image 36
Elthan Avatar answered Oct 22 '25 02:10

Elthan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!