Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make Azure Functions not publicly accessible?

Currently my functions are accessible publicly. Is there a way to make it so that they can only be accessed via something else, like an API gateway, and not directly? I tried adding a VNET via the "networking" blade but I don't think that did anything (I could still call the functions publicly)...I think that just makes it so the functions could access resources on a private network. I didn't see any options in the settings to make the IP private. I'm not very well versed in networking related issues, so apologies if I'm being unclear.

like image 227
Architekt Avatar asked Feb 16 '17 00:02

Architekt


People also ask

Can Azure Functions be private?

Azure Private Endpoint is a network interface that connects you privately and securely to a service powered by Azure Private Link. Private Endpoint uses a private IP address from your virtual network, effectively bringing the service into your virtual network.

How do you make a function app private?

Within the function app, select the Networking link under the Settings section header. The Networking page is the starting point to configure Azure Front Door, the Azure CDN, and also Access Restrictions. Select Configure Access Restrictions to configure private site access.

Are Azure Functions public?

By default azure functions are public . So you deploy them and the endpoint is available publicly via the address on the function. As you mentioned , you can set function level access, which means you need to pass an access key.


2 Answers

The built-in keys support is meant to provide an option for this. You can require all requests to include an API key which is only shared with resources you care about. In fact, all HTTP-triggered functions require a key by default. You would have to explicitly choose to remove this requirement.

Keys aren't a networking solution though, and if you leak the keys, someone could access your APIs (until you roll the keys). You are correct that the VNet support is point-to-site, meaning it can access resources, but the function app is not protected itself. An App Service Environment would solve that, although Kai's comment on the original question is correct - ASE is not yet available for Functions.

In addition to keys, you could look at using App Service Authentication / Authorization to require an AAD service principal. This is effectively like a key, but has additional benefits if you are modeling other entities in AAD. Unless you know you need this, though, I would stick with keys.

like image 146
mattchenderson Avatar answered Oct 21 '22 05:10

mattchenderson


With CORS functionnality you can restrict access to your Azure Function. To configure this, check the following link : Azure Function Settings, at the CORS section.

like image 40
Rom Eh Avatar answered Oct 21 '22 04:10

Rom Eh