Skip to content

Commit 4ec2db3

Browse files
committed
wip
Signed-off-by: Bryan Cox <[email protected]>
1 parent 5969417 commit 4ec2db3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/storage/azure/azure.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,17 @@ func NewDriver(ctx context.Context, c *imageregistryv1.ImageRegistryConfigStorag
334334
}
335335

336336
func (d *driver) newAzClient(cfg *Azure, environment autorestazure.Environment, tagset map[string]*string) (*azureclient.Client, error) {
337+
// Check if we have cached credentials for UserAssignedIdentityCredentials
338+
var cachedCreds azcore.TokenCredential
339+
userAssignedIdentityCredentialsFilePath := os.Getenv("MANAGED_AZURE_HCP_CREDENTIALS_FILE_PATH")
340+
if userAssignedIdentityCredentialsFilePath != "" {
341+
if storedCreds, found := d.azureCredentials.Load(azureCredentialsKey); found {
342+
if creds, ok := storedCreds.(azcore.TokenCredential); ok {
343+
cachedCreds = creds
344+
}
345+
}
346+
}
347+
337348
client, err := azureclient.New(&azureclient.Options{
338349
Environment: environment,
339350
TenantID: cfg.TenantID,
@@ -343,6 +354,7 @@ func (d *driver) newAzClient(cfg *Azure, environment autorestazure.Environment,
343354
SubscriptionID: cfg.SubscriptionID,
344355
TagSet: tagset,
345356
Policies: d.policies,
357+
Creds: cachedCreds,
346358
})
347359
if err != nil {
348360
return nil, err

0 commit comments

Comments
 (0)