【问题标题】:Windows Azure - create subscription programmaticallyWindows Azure - 以编程方式创建订阅
【发布时间】:2014-03-19 17:43:36
【问题描述】:

有没有办法以编程方式创建新订阅并将其添加到 Windows Azure 帐户?

目标是拥有一个 Web 应用程序,用户可以在其中注册和部署一组虚拟机(自动)。 Web 应用程序应使用现有的 Windows Azure 帐户并向其添加新订阅,然后用于为新用户部署计算机。

对于无需手动访问管理门户和添加新订阅的实现此功能有何建议?

【问题讨论】:

  • 很遗憾,答案是正确的——您无法以编程方式创建订阅。如果您最终使用单个订阅,则需要注意(如果您还没有的话)每个订阅的云服务、VM 和内核的数量是有限制的。例如 - 每个订阅 2000 个核心。

标签: azure


【解决方案1】:

没有 REST API 或任何其他用于创建订阅的编程方法。订阅有相关的安全检查、具体方案、支付方式等。这部分必须通过windowsazure.com门户完成。

不过,一旦完成,您就可以以编程方式创建云服务、部署 VM(基于图库图像或您自己的自定义图像),以及几乎其他任何事情。

【讨论】:

    【解决方案2】:

    订阅必须通过门户创建。其他一切都可以通过Azure Service Management apis 完成。

    【讨论】:

      【解决方案3】:

      Azure 似乎已经计划好了,但我很难找到任何进一步的细节。回复的管理员在 2016 年 6 月按计划提及。没有更多详细信息。

      https://feedback.azure.com/forums/170030-signup-and-billing/suggestions/13117482-api-for-creating-accounts-and-subscriptions

      【讨论】:

        【解决方案4】:

        Microsoft 合作伙伴中心有用于创建 Azure 订阅的 API:

        IAggregatePartner partnerOperations;
        string customerId;
        string offerId;
        
        var order = new Order()
        {
            ReferenceCustomerId = customerId,
            LineItems = new List<OrderLineItem>()
            {
                new OrderLineItem()
                {
                    OfferId = offerId,
                    FriendlyName = "new offer purchase",
                    Quantity = 5
                }
            }
        };
        
        var createdOrder = partnerOperations.Customers.ById(customerId).Orders.Create(order);
        

        来源:https://docs.microsoft.com/en-us/azure/cloud-solution-provider/integration/manage-customers/add-subscriptions#c

        在此处了解有关合作伙伴中心计划的更多信息:https://partnercenter.microsoft.com/en-us/partner/home

        【讨论】:

          【解决方案5】:

          在发表评论时,支持创建订阅作为企业协议 (EA) 的预览 API/Powershell/CLI

          https://docs.microsoft.com/en-us/azure/azure-resource-manager/programmatically-create-subscription?tabs=rest

          POST https://management.azure.com/providers/Microsoft.Billing/enrollmentAccounts/747ddfe5-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Subscription/createSubscription?api-version=2018-03-01-preview
          
          {
            "displayName": "Dev Team Subscription",
            "offerType": "MS-AZR-0017P",
            "owners": [
              {
                "objectId": "<userObjectId>"
              },
              {
                "objectId": "<servicePrincipalObjectId>"
              }
            ]
          }
          

          注意:使用 API 创建的订阅/帐户限制为 50 个

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2021-04-12
            • 1970-01-01
            • 2018-08-06
            • 2019-10-14
            • 1970-01-01
            • 1970-01-01
            • 2018-08-21
            • 1970-01-01
            相关资源
            最近更新 更多