Skip to content

Instantly share code, notes, and snippets.

@MichalGrzegorzak
Created June 6, 2023 11:51
Show Gist options
  • Save MichalGrzegorzak/a9fd337ce1e2d46a12cb73d39472a97d to your computer and use it in GitHub Desktop.
Save MichalGrzegorzak/a9fd337ce1e2d46a12cb73d39472a97d to your computer and use it in GitHub Desktop.
AzureFunction GetMyIP
[FunctionName(nameof(GetIP))]
public async Task<IActionResult> GetIP(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "check/getIp")] HttpRequest req, ILogger log)
{
log.LogInformation("GetIP called");
var client = new HttpClient();
var response = await client.GetAsync(@"https://ifconfig.me");
return new OkObjectResult(await response.Content.ReadAsStringAsync());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment