7

The service I wish to upgrade is in a resource group and my user account is configured as an owner of that resource group. The user account is limited to only access the one resource group.

I can successfully update the cloud service using the new management portal by uploading a cspkg and a cscfg file.

I'm trying to automate this process using Azure Powershell.

This is what I've tried so far:

Set-AzureDeployment -Upgrade -ServiceName test-service -Configuration C:\temp\test-service.cscfg -Package "https://test-service.blob.core.windows.net/azurepowershelldeploy/test-package.cspkg" -Slot Production -Mode Auto -Label test-2015-07-28T00:33:04

ForbiddenError: The server failed to authenticate the request.
Verify that the certificate is valid and is associated with this subscription.

Having a look in fiddler, it's making a request to this endpoint, and getting back a 403 forbidden.

POST /xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/services/hostedservices/test-service/deploymentslots/Production/?comp=upgrade HTTP/1.1

I believe the ASM API's don't work properly with resource groups. Is there a method to update a cloud service using the new ARM API's?

4

1 回答 1

0

您可以使用 ARM 在单个协调操作中部署、更新或删除应用程序的所有资源。

您可以使用以下方法将 ARM 模板重新部署到现有 RG:New-AzureResourceGroupDeployment

New-AzureResourceGroupDeployment cmdlet 将部署添加到现有资源组,包括部署所需的资源。此 cmdlet 类似于 New-AzureResourceGroup cmdlet,但它适用于现有资源组,而不是新资源组。若要将单个资源添加到资源组,请使用 New-AzureResource cmdlet。

您的方案(有一些更改)的一个很好的演练是:在 Azure 中以可预测的方式预配和部署微服务

本教程展示了如何使用 JSON 资源组模板和 PowerShell 脚本以可预测的方式在 Azure 应用服务中以可预测的方式预配和部署由 Azure 应用服务中的微服务组成的应用程序。

不要在 RG 模板中使用应用服务资源,而是使用您需要的资源类型。然后调用上面的 New-AzureResourceGroupDeployment cmdlet 而不是 New-AzureResourceGroup cmdlet。

于 2015-08-28T15:23:32.240 回答