Skip to content

Commit

Permalink
Authentication: Refreshing the Service Principal Token before using it (
Browse files Browse the repository at this point in the history
#1544)

This fix was originally contributed by @sophos-jeff in #1349 but has been split-out

This allows Azure CLI auth to be used to accessing Key Vaults, which fixes #656.
  • Loading branch information
tombuildsstuff authored Jul 16, 2018
1 parent b07ed7a commit 4656313
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ func getAuthorizationToken(c *authentication.Config, oauthConfig *adal.OAuthConf
return nil, err
}

err = spt.Refresh()

if err != nil {
return nil, fmt.Errorf("Error refreshing Service Principal Token: %+v", err)
}

auth := autorest.NewBearerAuthorizer(spt)
return auth, nil
}
Expand Down

0 comments on commit 4656313

Please sign in to comment.