在我的脚本中一切正常,直到我到达实际的命令。 我的云服务扩展支持已创建。我想使用新的 csdef、cspkg 和 cscfg 文件更新它。 当我运行此命令时:
New-AzCloudService
-Name "xxx"
-ResourceGroupName "xxx"
-Location "North Central US"
-ConfigurationFile $cspkgFilePath
-DefinitionFile $csdefFilePath
-PackageURL $cspkgUrl
我收到以下错误:
资源组“xxx”中已存在名称为“xxx”的云服务资源。请尝试其他名称。
我并不是要创建新的云服务,只是想更新现有的云服务。
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
注意:
New-AzCloudService
是仅用于创建云服务的命令。