【问题标题】:Equivalent Azure ARM APIs for ComputeManagementClient operations like create, get, swap用于 ComputeManagementClient 操作(如创建、获取、交换)的等效 Azure ARM API
【发布时间】:2018-02-08 14:52:09
【问题描述】:

我必须用 Azure ARM 替换服务管理 API,我发现很难找到以下等效 Azure ARM API 的适当文档

1) ComputeManagementClient.Deployments.Create - 我在 azure 资源浏览器的帮助下找到了按插槽获取部署的 API。

https://management.azure.com/subscriptions/{mySubID}/resourceGroups/{myResourcegroup}/providers/Microsoft.ClassicCompute/domainNames/{myCloudService}/slots/Production?api-version=2016-04-01

PUT/POST 请求正文是什么?

2) ComputeManagementClient.Deployments.swap - 使用生产槽交换部署的 API 是什么?

3) ComputeManagementClient.HostedServices.Create

 https://management.azure.com/subscriptions/{mySubID}/resourceGroups/{myResourcegroup}/providers/Microsoft.ClassicCompute/domainNames/{myCloudService}/slots/Production?api-version=2016-04-01

上面的 API 会创建云服务吗?如果是这样,请求正文中应该包含哪些参数?

【问题讨论】:

    标签: azure azure-cloud-services azure-resource-manager service-management


    【解决方案1】:

    要创建部署槽,您可以调整这个手臂模板块(属性是主体,路径是名称 + 类型的组合),请参阅 this 以获取更多示例:

        {
            "apiVersion": "2015-06-01",
            "name": "slotName",
            "type": "Microsoft.ClassicCompute/domainNames/slots",
            "dependsOn": [
                "cloudServiceName"
            ],
            "properties": {
                "deploymentLabel": "[parameters('deploymentLabel')]",
                "packageLink": {
                    "Uri": "[parameters('packageLink')]"
                },
                "configurationLink": {
                    "Uri": "[parameters('configurationLink')]"
                },
                "deploymentOptions": "[parameters('deploymentOptions')]"
            }
        }
    

    此外,此类信息的最佳来源是提琴手;)(至少我是这样知道的)

    【讨论】:

      【解决方案2】:

      对于 Deployments.Create,请参阅 4c74356b41 的答案。我在我这边测试了创建云服务和交换槽,它工作正常。

      ComputeManagementClient.Deployments.swap - 使用生产槽交换部署的 API 是什么?

      请尝试使用以下 REST API 将部署与生产槽交换。

      post https://management.azure.com/subscriptions/{subscriptionid}/resourceGroups/{resourcegroupname}/providers/Microsoft.ClassicCompute/domainNames/{cloudservicename}/swap?api-version=2015-06-01
      

      上面的 API 会创建云服务吗?如果是这样,请求正文中应该包含哪些参数?

      是的,我们可以使用 Rest API 来创建云服务。

      put https://management.azure.com/subscriptions/{subscriptionid}/resourceGroups/{resourcegroupname}/providers/Microsoft.ClassicCompute/domainNames/{cloudservicename}?api-version=2016-04-01
      

      主体:

        {
         "properties": {},
         "location": "eastus" //location
        }
      

      注意:请确保您的订阅支持在该位置创建云服务。如果不支持,会报如下错误。

      位置限制无效

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-11-28
        • 1970-01-01
        • 1970-01-01
        • 2015-11-17
        • 1970-01-01
        • 1970-01-01
        • 2014-10-24
        相关资源
        最近更新 更多