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

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 CLI “az vm image terms” and Azure PowerShell cmdlets Set-AzMarketplaceTerms and Get-AzMarketplaceTerms in Az.MarketplaceOrdering

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

Image for post
Image for post

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

Written by

Principal Engineer / Architect, FastTrack for Azure at Microsoft

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store