如何以编程方式接受Sendgrid青铜帐户的ARM模板的Marketplace条款

时间:2019-05-14 12:16:10

标签: azure azure-devops sendgrid azure-resource-manager arm-template

我能够使用ARM模板创建免费的sendgrid帐户,但无法创建青铜类型的帐户。

{
  "name": "[variables('testsendgrid')]",
  "type": "Sendgrid.Email/accounts",
  "location": "[resourceGroup().location]",
  "apiVersion": "2015-01-01",
  "plan": {
    "name": "bronze",
    "publisher": "Sendgrid",
    "product": "sendgrid_azure",
    "promotionCode": ""
  },
  "properties": {
    "password": "[variables('pswd')]",
    "acceptMarketingEmails":true,
    "email": "xxx.xx@xx.com"
   }
  }

“错误”:{    “ code”:“ ResourcePurchaseValidationFailed”,     “消息”:“用户验证购买资源失败。错误消息:此订阅上的该项目未接受法律条款:'dXXXX-xxxx-xx-xx-xxxxxxxxxx'。要使用PowerShell接受法律条款,请使用Get-AzureRmMarketplaceTerms和Set-AzureRmMarketplaceTerms API(https://go.microsoft.com/fwlink/?linkid=862451)或通过Azure门户进行部署以接受条款“”  }

2 个答案:

答案 0 :(得分:0)

您需要运行几行PowerShell以获取并设置对条款的接受程度。例如:

$terms = Get-AzureRmMarketplaceTerms -Publisher 'SendGrid' -Product 'sendgrid_azure' -Name 'bronze'
Set-AzureRmMarketplaceTerms -Publisher 'SendGrid' -Product 'sendgrid_azure' -Name 'bronze' -Terms $terms -Accept

确保将属性Accepted:设置为True。结果: enter image description here

答案 1 :(得分:0)

从错误中您遇到的共享问题是因为您尚未接受SendGrid条款和条件。每个订阅只需要执行一次。

Powershell:

https://docs.microsoft.com/en-us/powershell/module/azurerm.marketplaceordering/Set-AzureRmMarketplaceTerms?view=azurermps-6.13.0

RestAPI (因为您使用的是JSON)

https://blogs.msdn.microsoft.com/arsen/2017/10/02/azure-marketplace-api-to-programmatically-review-and-accept-publisher-agreementeula/