如何使用 powershell 更新我的 Azure 云服务扩展支持?

问题描述 投票:0回答:1

在我的脚本中一切正常,直到我到达实际的命令。 我的云服务扩展支持已创建。我想使用新的 csdef、cspkg 和 cscfg 文件更新它。 当我运行此命令时:

New-AzCloudService 
-Name "xxx" 
-ResourceGroupName "xxx" 
-Location "North Central US" 
-ConfigurationFile $cspkgFilePath 
-DefinitionFile $csdefFilePath 
-PackageURL $cspkgUrl

我收到以下错误:

资源组“xxx”中已存在名称为“xxx”的云服务资源。请尝试其他名称。

我并不是要创建新的云服务,只是想更新现有的云服务。

azure azure-cloud-services
1个回答
0
投票

要更新现有的云服务角色或配置,您需要使用

Update-AzCloudService
PowerShell 命令,如下所示。

$cloudservice=Get-AzCloudService -ResourceGroupName "Jahnavi" -CloudServiceName "newclouds"
$cloudservice.Configuration
$updateddef="ServiceDefinition.csdef"
$content = Get-Content $updateddef | Out-String
$cloudservice.configuration=$content
$cloudservice | Update-AzCloudService

enter image description here

注意

New-AzCloudService
是仅用于创建云服务的命令。

© www.soinside.com 2019 - 2024. All rights reserved.