In Azure, I have an Azure Function which uses .NET and is defined as follows

#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using System.Net.Http;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
using(var client = new HttpClient())
String accessToken = XXXXXXXXXX;
client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", accessToken);
var result = await client.GetAsync("https://allstate.myabsorb.com/api/rest/v1/Coupons");
string resultContent = await result.Content.ReadAsStringAsync();
return (ActionResult) new OkResult();

I originally ran this as a stand-alone function and it runs successfully. The

in the code above represents an authorization token, which runs successfully if I hard-code this token into the code. However, as the token changes, I created a step in Azure Data Factory that retrieves the updated token and stores it in a variable. I want to take that ADF variable and pass it into the function. What do I need to do in the code in order for the function to be able to interpret this ADF variable when the function gets executed?

All I’m trying to pass into the function is a single string. I just have no idea how to do this and can’t find any examples that are simplistic enough for my smooth ape brain to comprehend. I feel like this is should be a fairly simple process, but I just can’t figure it out… What do?

EDIT: to clarify, my main problem here is I don’t know what to put in the code for it to receive the variable from ADF.

Anonymous Asked question May 13, 2021