Skip to content

Commit

Permalink
Merge pull request #483 from jeffreyCline/master
Browse files Browse the repository at this point in the history
Append AZURE_HTTP_USER_AGENT environment variable to UserAgent string.
  • Loading branch information
tombuildsstuff authored Nov 4, 2017
2 parents 6edfc1d + 80053f7 commit d6f95ed
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"net/http"
"net/http/httputil"
"os"

"github.com/Azure/azure-sdk-for-go/arm/appinsights"
"github.com/Azure/azure-sdk-for-go/arm/authorization"
Expand Down Expand Up @@ -190,6 +191,13 @@ func withRequestLogging() autorest.SendDecorator {
func setUserAgent(client *autorest.Client) {
version := terraform.VersionString()
client.UserAgent = fmt.Sprintf("HashiCorp-Terraform-v%s", version)

// append the CloudShell version to the user agent
if azureAgent := os.Getenv("AZURE_HTTP_USER_AGENT"); azureAgent != "" {
client.UserAgent = fmt.Sprintf("%s;%s", client.UserAgent, azureAgent)
}

log.Printf("[DEBUG] User Agent: %s", client.UserAgent)
}

func (c *Config) getAuthorizationToken(oauthConfig *adal.OAuthConfig, endpoint string) (*autorest.BearerAuthorizer, error) {
Expand Down

0 comments on commit d6f95ed

Please sign in to comment.