共用方式為


Update-AzCloudService

建立或更新雲端服務。 請注意,某些屬性只能在雲端服務建立期間設定。

語法

Update-AzCloudService
      -InputObject <ICloudServiceIdentity>
      -Parameter <ICloudService>
      [-DefaultProfile <PSObject>]
      [-AsJob]
      [-NoWait]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

建立或更新雲端服務。 請注意,某些屬性只能在雲端服務建立期間設定。

範例

範例 1:將 RDP 擴充功能新增至現有的雲端服務

# Create RDP extension object
$rdpExtension = New-AzCloudServiceRemoteDesktopExtensionObject -Name "RDPExtension" -Credential $credential -Expiration $expiration -TypeHandlerVersion "1.2.1"
# Get existing cloud service
$cloudService = Get-AzCloudService -ResourceGroupName "ContosOrg" -CloudServiceName "ContosoCS"
# Add RDP extension to existing cloud service extension object
$cloudService.ExtensionProfile.Extension = $cloudService.ExtensionProfile.Extension + $rdpExtension
# Update cloud service
$cloudService | Update-AzCloudService

上述一組命令會將 RDP 擴充功能新增至已命名為 ContosoCS 的現有雲端服務,其屬於名為 ContosOrg 的資源群組。

範例 2:從雲端服務移除所有擴充功能

# Get existing cloud service
$cloudService = Get-AzCloudService -ResourceGroupName "ContosOrg" -CloudServiceName "ContosoCS"
# Set extension to empty list
$cloudService.ExtensionProfile.Extension = @()
# Update cloud service
$cloudService | Update-AzCloudService

上述命令集合會從屬於名為 ContosOrg 的資源群組的現有雲端服務中移除所有擴充功能。

範例 3:從雲端服務移除 RDP 擴充功能

# Get existing cloud service
$cloudService = Get-AzCloudService -ResourceGroupName "ContosOrg" -CloudServiceName "ContosoCS"
# Remove extension by name RDPExtension
$cloudService.ExtensionProfile.Extension = $cloudService.ExtensionProfile.Extension | Where-Object { $_.Name -ne "RDPExtension" }
# Update cloud service
$cloudService | Update-AzCloudService

上述一組命令會從屬於 ContosOrg 資源群組的現有雲端服務中移除 RDP 擴充功能。

範例 4:Scale-Out/Scale-In 角色實例

# Get existing cloud service
$cloudService = Get-AzCloudService -ResourceGroupName "ContosOrg" -CloudServiceName "ContosoCS"

# Scale-out all role instance count by 1
$cloudService.RoleProfile.Role | ForEach-Object {$_.SkuCapacity += 1}

# Scale-in ContosoFrontend role instance count by 1
$role = $cloudService.RoleProfile.Role | Where-Object {$_.Name -eq "ContosoFrontend"}
$role.SkuCapacity -= 1

# Update cloud service configuration as per the new role instance count
$cloudService.Configuration = $configuration

# Update cloud service
$cloudService | Update-AzCloudService

上述一組命令示範如何針對屬於 ContosOrg 資源群組的雲端服務相應放大和相應縮小角色實例計數。

參數

-AsJob

以作業身分執行命令

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

DefaultProfile 參數無法運作。 如果針對不同的訂用帳戶執行 Cmdlet,請使用 SubscriptionId 參數。

類型:PSObject
別名:AzureRMContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-InputObject

Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

類型:ICloudServiceIdentity
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-NoWait

以異步方式執行命令

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Parameter

描述雲端服務。 若要建構,請參閱PARAMETER屬性和建立哈希表的NOTES一節。

類型:ICloudService
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-WhatIf

顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。

類型:SwitchParameter
別名:wi
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

ICloudService

ICloudServiceIdentity

輸出

ICloudService