【发布时间】:2022-08-02 17:22:37
【问题描述】:
几天前,我从 Azure 云服务转移了我的服务经典的到云服务扩展支持.最新的没有生产/登台插槽。如果在部署期间我们配置了“可交换云服务”,则会激活一种新的交换机制。我可以使用 Visual Studio 发布魔法来做到这一点,而且效果很好。
现在我想使用 powershell 脚本进行部署。下面的代码只是创建一个没有激活交换的新部署。它工作正常。
New-AzCloudService -Name $stagingName `
-ResourceGroupName $resourceGroupName `
-Location $location `
-ConfigurationFile $cscfgFilePath `
-DefinitionFile $csdefFilePath `
-PackageFile $cspkgFilePath `
-StorageAccount $storageAccount `
-KeyVaultName $keyVaultName
我没有找到任何关于如何将“可交换云服务”添加到New-AzCloudService.我发现有这样的设置NetworkProfile.SwappableCloudService.Id但我不明白如何正确设置它。例如,如果我添加:
$production= Get-AzCloudService -ResourceGroup $resourceGroupName -CloudServiceName $productionName
$production.NetworkProfile.SwappableCloudService.Id = $production.Name # just to reuse the object
$loadBalancerConfig = CreateLoadBalancerConfig
$networkProfile = @{loadBalancerConfiguration = $loadBalancerConfig; swappableCloudService = $production.NetworkProfile.SwappableCloudService }
New-AzCloudService -Name $stagingName `
...
-NetworkProfile $networkProfile `
我得到了错误:
New-AzCloudService : Parameter set cannot be resolved using the specified named parameters
是否可以为 New-AzCloudService 设置“可交换云服务”?怎么做?
是否可以在部署后设置“可交换云服务”(以任何方式,Azure 门户、API、powershell 等)?
标签: azure azure-powershell azure-cloud-services