package managedidentity

import "github.com/AzureAD/microsoft-authentication-library-for-go/apps/managedidentity"

Package managedidentity provides a client for retrieval of Managed Identity applications. The Managed Identity Client is used to acquire a token for managed identity assigned to an azure resource such as Azure function, app service, virtual machine, etc. to acquire a token without using credentials.

Index

Constants

const (
	TokenSourceIdentityProvider = base.TokenSourceIdentityProvider
	TokenSourceCache            = base.TokenSourceCache
)

Types

type AcquireTokenOption

type AcquireTokenOption func(o *AcquireTokenOptions)

func WithClaims

func WithClaims(claims string) AcquireTokenOption

WithClaims sets additional claims to request for the token, such as those required by token revocation or conditional access policies. Use this option when Azure AD returned a claims challenge for a prior request. The argument must be decoded.

type AcquireTokenOptions

type AcquireTokenOptions struct {
	// contains filtered or unexported fields
}

type AuthResult

type AuthResult = base.AuthResult

AuthResult contains the results of one token acquisition operation. For details see https://aka.ms/msal-net-authenticationresult

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(id ID, options ...ClientOption) (Client, error)

Client to be used to acquire tokens for managed identity. ID: SystemAssigned, UserAssignedClientID, UserAssignedResourceID, UserAssignedObjectID

Options: WithHTTPClient

func (Client) AcquireToken

func (c Client) AcquireToken(ctx context.Context, resource string, options ...AcquireTokenOption) (AuthResult, error)

Acquires tokens from the configured managed identity on an azure resource.

Resource: scopes application is requesting access to Options: WithClaims

type ClientOption

type ClientOption func(*Client)

func WithHTTPClient

func WithHTTPClient(httpClient ops.HTTPClient) ClientOption

WithHTTPClient allows for a custom HTTP client to be set.

func WithRetryPolicyDisabled

func WithRetryPolicyDisabled() ClientOption

type ID

type ID interface {
	// contains filtered or unexported methods
}

func SystemAssigned

func SystemAssigned() ID

type Source

type Source string
const (
	// DefaultToIMDS indicates that the source is defaulted to IMDS when no environment variables are set.
	DefaultToIMDS Source = "DefaultToIMDS"
	AzureArc      Source = "AzureArc"
	ServiceFabric Source = "ServiceFabric"
	CloudShell    Source = "CloudShell"
	AzureML       Source = "AzureML"
	AppService    Source = "AppService"
)

func GetSource

func GetSource() (Source, error)

GetSource detects and returns the managed identity source available on the environment.

type TokenSource

type TokenSource = base.TokenSource

type UserAssignedClientID

type UserAssignedClientID string

type UserAssignedObjectID

type UserAssignedObjectID string

type UserAssignedResourceID

type UserAssignedResourceID string

Source Files

azure_ml.go cloud_shell.go managedidentity.go servicefabric.go

Version
v1.4.2 (latest)
Published
Mar 26, 2025
Platform
linux/amd64
Imports
19 packages
Last checked
2 days ago

Tools for package owners.