Restricting Azure Function HTTP Trigger to Specific SharePoint Site Requests

Copper Contributor

Hello,

 

In an Azure Function with an HTTP Trigger, is there a way to limit the triggering of the function to requests coming only from a specific SharePoint site? For example, I have a SharePoint site with a clickable link that contains the URL of the Azure Function, and I'd like the function to be triggered only if the link is clicked from the SharePoint site. If someone copies and pastes the URL of the function and the browser directly, it should not work.

 

Thanks in advance for your help with this.

2 Replies

@lexignot 

 

How about by using User-Agent Header Check?

@lexignot 

 

you can use the EventGrid Function as below:
BinaryData events = await BinaryData.FromStreamAsync(req.Body);
EventGridEvent[] eventGridEvents = EventGridEvent.ParseMany(events);
var details = JsonConvert.DeserializeObject<add your class>(eventGridEvents.First().Data.ToString());
if (details .source != "SharePoint"){
// Perform
}
// do nothing