Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override User-Agent for Azure partner customer attribution #2157

Closed
ms1111 opened this issue Oct 25, 2018 · 4 comments
Closed

Override User-Agent for Azure partner customer attribution #2157

ms1111 opened this issue Oct 25, 2018 · 4 comments

Comments

@ms1111
Copy link

ms1111 commented Oct 25, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

When a Microsoft partner deploys resources into a customer's subscription, Microsoft likes to know which partner is responsible for the deployments. (Among other reasons, this helps with tracking when partners are driving increased Azure adoption.)

The way to do this seems to be to set a User-Agent like pid-7d85a862-78c1-4ea3-bfda-67fada6e3bb9 when making request to the ARM API:

https://docs.microsoft.com/en-us/azure/marketplace/azure-partner-customer-usage-attribution#tag-a-deployment-with-the-resource-manager-apis

For example, the az cli allows the user to set an environment variable like export AZURE_HTTP_USER_AGENT='pid-eb7927c8-dd66-43e1-b0cf-c346a422063' which is then used for all HTTP calls.

New or Affected Resource(s)

N/A

Potential Terraform Configuration

For consistency with the az cli, one option would be to read an environment variable AZURE_HTTP_USER_AGENT.

It might be cleaner to define a user_agent parameter in the azurerm provider instead.

If not specified, the current User-Agent behaviour would be used.

@joakimhellum
Copy link

joakimhellum commented Oct 26, 2018

I thought this was already implemented in #483. Sorry if this is some other issue.

If I do this:

export AZURE_HTTP_USER_AGENT=my-agent
terraform init
terraform plan

Then I can see the following in the debug logs:

[DEBUG] AzureRM Client User Agent: Go/go1.10.3 (amd64-windows) go-autorest/v10.15.4 Azure-SDK-For-Go/v21.1.0 insights/2015-05-01 Terraform/0.11.3 terraform-provider-azurerm/1.17.0 my-agent

@ms1111
Copy link
Author

ms1111 commented Oct 26, 2018

Thanks @joakimhellum-in ! I hadn't seen that. It's actually appending AZURE_HTTP_USER_AGENT rather than overriding it, which may or may not work for customer attribution but I'll try it at some point and make a PR if it doesn't.

@ms1111 ms1111 closed this as completed Oct 26, 2018
@richeney
Copy link
Contributor

Would it be possible to re-open this to add user_agent as a new argument in the AzureRM provider block? This would work well where you have multiple AzureRM provider blocks and aliases, given that the generated GUID should represent the combination of an offer and distribution channel.
https://docs.microsoft.com/en-us/azure/marketplace/azure-partner-customer-usage-attribution#create-guids

@ghost
Copy link

ghost commented Mar 5, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants