<PackageReference Include="System.ClientModel" Version="1.2.1" />

ApiKeyAuthenticationPolicy

A PipelinePolicy that uses an ApiKeyCredential to set a value on a PipelineRequest to authenticate with the cloud service.

Create a new instance of the ApiKeyAuthenticationPolicy class, where the credential value will be set in the Authorization header on the PipelineRequest with a Basic prefix.

Create a new instance of the ApiKeyAuthenticationPolicy class, where the credential value will be set in the Authorization header on the PipelineRequest with a Bearer prefix.

public static ApiKeyAuthenticationPolicy CreateHeaderApiKeyPolicy(ApiKeyCredential credential, string headerName, string keyPrefix = null)

Create a new instance of the ApiKeyAuthenticationPolicy class, where the credential value will be specified in a request header.