There are various ways of authenticating against Azure Functions but the default method is by providing a code value as a URL parameter in the call to the endpoint.

If you’re using RestSharp to call your function there’s no specific authenticator to manage handling this parameter but it is pretty simple to create your own custom authenticator by implementing IAuthenticator as shown below.

public class AzureFunctionAuthenticator : IAuthenticator
{
	private readonly string _code;

	public AzureFunctionAuthenticator(string code)
	{
		_code = code;
	}

	public void Authenticate(IRestClient client, IRestRequest request)
		=> request
			.AddParameter("code", _code, ParameterType.QueryString);
}

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *