Skip to content

Commit

Permalink
do not use deprecated method
Browse files Browse the repository at this point in the history
Signed-off-by: Amr Hanafi (MAHDI)) <amrh@microsoft.com>
  • Loading branch information
amrmahdi committed Sep 7, 2021
1 parent 29c3943 commit 6fe6710
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/objstore/azure/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ func getServicePrincipalToken(logger log.Logger, conf Config) (*adal.ServicePrin
resource = fmt.Sprintf("https://%s.%s", conf.StorageAccountName, conf.Endpoint)
}

msiConfig := auth.MSIConfig{
Resource: resource,
}

if conf.UserAssignedID != "" {
level.Debug(logger).Log("msg", "using user assigned identity:", conf.UserAssignedID)
return adal.NewServicePrincipalTokenFromMSIWithUserAssignedID("", resource, conf.UserAssignedID)
level.Debug(logger).Log("msg", "using user assigned identity", "clientId", conf.UserAssignedID)
msiConfig.ClientID = conf.UserAssignedID
} else {
level.Debug(logger).Log("msg", "using system assigned identity")
}

level.Debug(logger).Log("msg", "using system assigned identity")
msiConfig := auth.NewMSIConfig()
msiConfig.Resource = conf.MSIResource
return msiConfig.ServicePrincipalToken()
}

Expand Down

0 comments on commit 6fe6710

Please sign in to comment.