Skip to content

Instantly share code, notes, and snippets.

@DexterPOSH
Created May 17, 2019 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DexterPOSH/4fab0779bdc0d98b16ef7cc1fa647be6 to your computer and use it in GitHub Desktop.
Save DexterPOSH/4fab0779bdc0d98b16ef7cc1fa647be6 to your computer and use it in GitHub Desktop.
NewAuthorizerFromEnvironment() method def from github.com/Azure/go-autorest/autorest/azure/auth package
// NewAuthorizerFromEnvironment creates an Authorizer configured from environment variables in the order:
// 1. Client credentials
// 2. Client certificate
// 3. Username password
// 4. MSI
func NewAuthorizerFromEnvironment() (autorest.Authorizer, error) {
settings, err := getAuthenticationSettings()
if err != nil {
return nil, err
}
if settings.resource == "" {
settings.resource = settings.environment.ResourceManagerEndpoint
}
return settings.getAuthorizer()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment