Release Summary: Add Managed Identity Support
Overview
This Release introduces Managed Identity support to the Microsoft Authentication Library for Go through a new client. The new client supports multiple sources for managed identities, including:
- IMDS
- Azure Arc
- Service Fabric
- App Service
- Azure Machine Learning
- Cloud Shell
The client can handle both System Assigned Managed Identities and User Assigned Managed Identities.
For user-assigned identities, you can specify:
- Client ID
- Resource ID
- Object ID
Key Changes
- New Managed Identity Client: Added a new client to handle managed identity authentication.
- Multiple Sources Support: The client supports various managed identity sources, enhancing flexibility and usability.
- Tests: Comprehensive tests have been added to ensure the reliability and correctness of the new functionality.
- Documentation: Updated documentation to include details on the new managed identity client and usage instructions.
Code Sample
Here's a basic example of how to use the new managed identity client to acquire a token:
package main
import (
"context"
"fmt"
"github.com/AzureAD/microsoft-authentication-library-for-go/msal"
)
func main() {
miSystemAssigned, err := mi.New(mi.SystemAssigned())
if err != nil {
log.Fatal(err)
}
result, err := miSystemAssigned.AcquireToken(context.TODO(), "https://management.azure.com")
if err != nil {
log.Fatal(err)
}
fmt.Println("token expire at : ", result.ExpiresOn)
}