Uppdatera Azure Cloud Service (utökad support)

De här exemplen beskriver olika sätt att uppdatera en befintlig Distribution av Azure Cloud Service (utökad support).

Lägga till ett tillägg till befintlig molntjänst

Nedanstående uppsättning kommandon lägger till ett RDP-tillägg till en redan befintlig molntjänst med namnet ContosoCS som tillhör resursgruppen ContosOrg.

# Create RDP extension object
$rdpExtension = New-AzCloudServiceRemoteDesktopExtensionObject -Name "RDPExtension" -Credential $credential -Expiration $expiration -TypeHandlerVersion "1.2.1"
# Get existing cloud service
$cloudService = Get-AzCloudService -ResourceGroup "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

Ta bort alla tillägg från en molntjänst

Nedan uppsättning kommandon tar bort alla tillägg från en befintlig molntjänst med namnet ContosoCS som tillhör resursgruppen ContosOrg.

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

Ta bort fjärrskrivbordstillägget från Cloud Service

Nedan uppsättning kommandon tar bort RDP-tillägget från en befintlig molntjänst med namnet ContosoCS som tillhör resursgruppen ContosOrg.

# Get existing cloud service
$cloudService = Get-AzCloudService -ResourceGroup "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

Skalbara/inskalningsrollinstanser

Nedan uppsättning kommandon visar hur du skalar ut och skalar in rollinstanser för molntjänsten ContosoCS som tillhör resursgruppen Med namnet ContosOrg.

# Get existing cloud service
$cloudService = Get-AzCloudService -ResourceGroup "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

Nästa steg

Mer information om Azure Cloud Services (utökad support) finns i Översikt över Azure Cloud Services (utökad support).