【问题标题】:Azure Cloud Services Extended Support Deploy using New-AzCloudService powershell. Set swappable cloud serviceAzure 云服务扩展支持使用 New-AzCloudService powershell 进行部署。设置可交换的云服务
【发布时间】: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


    【解决方案1】:

    尝试$production.Id 而不是$production.Name。或者$production.id(我不确定这个案例是否重要)。

    【讨论】:

      【解决方案2】:

      我怀疑这个问题与使用-ConfigurationFile-DefinitionFile-PackageFile 时不支持-NetworkProfile 有关。

      documentation 中,-NetworkProfile-PackageUrl-Configuration 一起使用。

      我有askedMicrosoft 对此问题,因为我遇到了同样的问题。

      【讨论】:

        猜你喜欢
        • 2023-01-17
        • 2014-12-15
        • 2014-12-13
        • 2016-06-12
        • 2012-08-17
        • 1970-01-01
        • 2017-06-24
        • 2012-09-05
        • 2018-08-29
        相关资源
        最近更新 更多