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
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 committed Jul 11, 2018
1 parent f92c132 commit 48a0701
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 @@ -310,6 +310,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 48a0701

Please sign in to comment.