是否可以使用 AZ powershell 脚本发布云服务包?

Is it possible to publish cloud service package using AZ powershell script?

我想了解是否可以使用 AZ powershell 将经典云服务包 (Microsoft.ClassicCompute) 部署到 Azure 部署槽。

已在 Azure 中创建的资源组中有一个经典服务。将要部署的包上传到单独的存储配置文件 blob。

目前,webroles 是使用 REST API 部署的。在 post 请求的元素中指定了 blob 中包的适当路径,这工作正常。

我正在尝试使用 AZ powershell 来做同样的事情,特别是通过使用指定的“-PropertyObject”参数调用 New-AzResource cmdlet:

@{
    deploymentLabel = 'XXX';
    configuration = '<?xml version=\"1.0\" encoding=\"utf-8\"?> ....  ';
    packageUrl = '{valid_url_to_package}';
    ....
}

但出现错误 returns:

The request content was invalid and could not be deserialized: 'Could not find member 'packageUrl' on object of type 'DeploymentSlotProperties'. Path 'properties.packageUrl'

如果从对象中删除 'packageUrl' 属性 并再次执行 cmdlet,则会显示另一个错误:

The deployment request is missing the package link.

遗憾的是,我找不到任何关于“-PropertyObject”参数格式的信息。或者也许有更好的方法通过 AZ 部署包?

根据我的研究,Azure PowerShell Az 模块用于管理 Azure ARM 资源。但 Azure Cloud 服务是经典资源。所以我们不能用 az 模块部署 azure 云服务。详情请参考document and . If you want to know to deploy Azure cloud service with PowerShell, please refer to https://github.com/MicrosoftDocs/azure-cloud-services-files/tree/master/Scripts/cloud-services-continuous-delivery