簡體   English   中英

Outbound IP for Python Azure Function - requests IP not match list of function outbound IP

[英]Outbound IP for Python Azure Function - requests IP not match list of function outbound IP

I ve created Python function on Azure that call external API service which allows to access only for whitelisted IPs.

根據 Microsoft 文檔( https://docs.microsoft.com/en-us/azure/azure-functions/ip-addresses ),我找到了所有 OutboundIPAddresses 和 PossibleOutboundAddresses 並將它們全部列入白名單。 盡管 IP 已被列入白名單,但我仍不斷收到來自服務的 403 Forrbiden 錯誤。

我還通過將以下代碼添加到 function 來驗證請求的 IP 地址:

ip = requests.request('GET','https://api.ipify.org').text
logging.info('Request send from IP: {}'.format(ip))

似乎實際出站 IP 地址是不同的,然后在 OutboundIPAddress 和 PossibleOutboundAddresses 列表中指定。

我會很感激你的幫助。

根據我們的文檔

當在 Consumption 計划或 Premium 計划上運行的 function 應用程序擴展時,可能會分配新的出站 IP 地址范圍。 在使用這些計划中的任何一個時,您可能需要將整個數據中心添加到允許列表中。

如果您需要將 function 應用程序使用的出站 IP 地址添加到許可名單,另一種選擇是將 function 應用程序的數據中心(Azure)添加到許可名單。 您可以 下載 JSON 文件,其中列出了所有 Azure 數據中心的 IP 地址 然后找到適用於 function 應用程序所在區域的 JSON 片段。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM