I'm trying to implement partner tagging of Azure resources by adding a partner product GUID to the User-Agent header when creating resources via the Resource Manager API, but it doesn't have any visible effect. I checked the ARM template of a "tagged" resource, but the GUID is not there. Verification method described in the article also gives negative results.
Does it work for anyone?
Here's the Powershell code based on the above guide that reproduces the issue:
Install-Module -Name Az -AllowClobber -Scope CurrentUser # installs Azure Powerhsell module
$partnerID = "pid-3fd1a53d-3ef0-4111-8a66-211ed6470935" # Product GUID
$VMLocalAdminUser = "partneridtest" # test VM username
$VMLocalAdminSecurePassword = ConvertTo-SecureString "Pa$$word123" -AsPlainText -Force # test VM password
$resourceGroupName=[guid]::NewGuid().ToString() # randomly generated resource group name
Import-Module -Name Az # import Azure Powerhsell module
[Microsoft.Azure.Common.Authentication.AzureSession]::ClientFactory.AddUserAgent($partnerID) # add user-agent for partner tracking
Connect-AzAccount # login to Azure
New-AzResourceGroup -Name $resourceGroupName -Location eastus # create a resource group
Write-Host Resource group name $resourceGroupName
$vmParams = @{
ResourceGroupName = $resourceGroupName
Name = 'PartnerIdTest1'
Location = 'eastus'
ImageName = 'Win2016Datacenter'
PublicIpAddressName = 'partnerIdTestPublicIp'
Credential = New-Object System.Management.Automation.PSCredential ($VMLocalAdminUser, $VMLocalAdminSecurePassword)
OpenPorts = 3389
}
$newVM1 = New-AzVM @vmParams # create a test VM (should be tagged with the partner product guid)
Get-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name $partnerID # fails with Get-AzResourceGroupDeployment : Deployment 'pid-3fd1a53d-3ef0-4111-8a66-211ed6470935' could not be found.
Note: the GUID above is random - not a real one. It should be replaced with a registered partner GUID.
Follow the below steps to add tags to a resource in Azure: Step 1: Select any of the Resources in Azure Portal. Step 2: After selecting the azure resource from the left menu search for tags and Select Tags. Step 3: Now, from the tags section you can add and remove to organize according to your needs.
In the data factory -> view cost -> add filter -> there is a resource guid filter available.
When tagging resources for attribution during deployment, there isn't anything visible on the resource itself that indicates the association, it's an internal implementation.
If your goal is to verify that the code you've written is working correctly (such that the resource will be properly attributed) there's currently no way to do this externally for the UserAgent method - we can only do it internally. You can verify for a template deployment using the script in the doc you linked to, but that will only work for template deployments not, API calls (TF, SDK, etc).
You won't see anything in the Partner Portal unless 1) the GUID is registered and 2) there is billable usage for the resource.
All that said - I did a quick peek in the logs and I do see some resources provisioned with 3fd1a53d-3ef0-4111-8a66-211ed6470935 in the userAgent.
That help?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With