Is there a way to retrieve the IP address of an Azure function?
I am looking for a method to make a request to the function and receive its IP address in return.
I attempted the following code, but it hung indefinitely without generating any results:
import { AzureFunction, Context, HttpRequest } from "@azure/functions";
const httpTrigger: AzureFunction = function (context: Context, req: HttpRequest): void {
console.log("HTTP trigger function processed a request.");
const ip = req.headers["x-forwarded-for"] as string;
context.res = {
body: { ip },
status: 200
};
};
export default httpTrigger;