Azure Marketplace API to programmatically review and accept publisher agreement/EULA

Arsen Vladimirskiy
Oct 2, 2017 · 2 min read

In this quick video walkthrough, I show how to use REST API to programmatically review and accept publisher agreement/EULA for Azure Marketplace VM images.

NOTE: You can also accept and review terms using Azure PowerShell cmdlets Set-AzureRmMarketplaceTerms and Get-AzureRmMarketplaceTerms

Video Walkthrough

Tip: Play the video full screen.

You will also find the following CURL code snippets useful to supplement the video.

GET request to retrieve agreement information

curl -X GET \ 'https://management.azure.com/subscriptions/{{subscription_id}}/providers/Microsoft.MarketplaceOrdering/offertypes/virtualmachine/publishers/{{publisher}}/offers/{{offer}}/plans/{{sku}}/agreements/current?api-version=2015-06-01' \ -H 'authorization: Bearer {{access_token}}' \

Sample response will look like this:

{
"id": "/subscriptions/{{subscription_id}}/providers/Microsoft.MarketplaceOrdering/offertypes/{{publisher}}/offers/{{offer}}/plans/{{sku}}",
"name": "{{sku}}",
"type": "Microsoft.MarketplaceOrdering/offertypes",
"properties": {
"publisher": "{{publisher}}",
"product": "{{offer}}",
"plan": "{{sku}}",
"licenseTextLink": "https://106c4.wpc.azureedge.net/80106C4/Gallery-Prod/cdn/2015-02-24/prod20161101-microsoft-windowsazure-gallery/offer-specific-legal-terms.txt",
"privacyPolicyLink": "{{publisher's privacy policy page URL}}",
"retrieveDatetime": "2017-10-02T19:51:05.2843331Z",
"signature": "XXXXXXXXXXXYK43BUSJDPLSYHID7SSQUUFNTSFK72VR5PSOQSWVHKD4BFPETFKGVB7SKXRZKK5R4ADNQ2Z2A",
"accepted": false
}
}

PUT request to update accepted flag

curl -X PUT \
'https://management.azure.com/subscriptions/{{subscription_id}}/providers/Microsoft.MarketplaceOrdering/offertypes/virtualmachine/publishers/{{publisher}}/offers/{{offer}}/plans/{{sku}}/agreements/current?api-version=2015-06-01' \
-H 'authorization: Bearer {{access_token}}' \
-H 'content-type: application/json' \
-d '{
"id": "/subscriptions/{{subscription_id}}/providers/Microsoft.MarketplaceOrdering/offertypes/{{publisher}}/offers/{{offer}}/plans/{{sku}}",
"name": "{{sku}}",
"type": "Microsoft.MarketplaceOrdering/offertypes",
"properties": {
"publisher": "{{publisher}}",
"product": "{{offer}}",
"plan": "{{sku}}",
"licenseTextLink": "https://106c4.wpc.azureedge.net/80106C4/Gallery-Prod/cdn/2015-02-24/prod20161101-microsoft-windowsazure-gallery/offer-specific-legal-terms.txt",
"privacyPolicyLink": "{{publisher'sp privacy policy page URL}}",
"retrieveDatetime": "2017-10-02T19:51:05.2843331Z",
"signature": "XXXXXXXXXXXYK43BUSJDPLSYHID7SSQUUFNTSFK72VR5PSOQSWVHKD4BFPETFKGVB7SKXRZKK5R4ADNQ2Z2A",
"accepted": true
}
}'

Thanks for watching!

Please leave feedback and questions below or on Twitter https://twitter.com/ArsenVlad


Originally published at blogs.msdn.microsoft.com on October 2, 2017.

Arsen Vladimirskiy

Written by

Azure Cloud Architect & Software Engineer at Microsoft, Commercial Software Engineering (CSE) Team