Table of Contents

Class ServiceContext

Namespace
FoundationaLLM.Common.Authentication
Assembly
FoundationaLLM.Common.dll

Provides the context of the current service.

public static class ServiceContext
Inheritance
ServiceContext
Inherited Members

Properties

AzureCredential

The default Azure credential to use for authentication.

public static TokenCredential? AzureCredential { get; set; }

Property Value

TokenCredential

Production

Indicates whether the environment we run in is production or not.

public static bool Production { get; set; }

Property Value

bool

ServiceIdentity

The UnifiedUserIdentity of the service based on its managed identity."/>

public static UnifiedUserIdentity? ServiceIdentity { get; set; }

Property Value

UnifiedUserIdentity

ServiceName

Gets or sets the name of the service.

public static string ServiceName { get; set; }

Property Value

string

Methods

CreateAzureCredential()

Creates a new TokenCredential.

public static TokenCredential CreateAzureCredential()

Returns

TokenCredential

A ManagedIdentityCredential instance if Production is true and an AzureCliCredential instance otherwise.

Initialize(bool, string, string)

Initializes the service context.

public static void Initialize(bool production, string serviceName, string scope = "api://FoundationaLLM-Authorization")

Parameters

production bool

Indicates whether the environment is production or not.

serviceName string

The service name.

scope string

The scope used to retrieve the access token.