Memperbarui Layanan Cloud Azure (dukungan yang diperluas)

Penting

Mulai 31 Maret 2025, Cloud Services (dukungan diperpanjang) tidak digunakan lagi dan akan sepenuhnya dihentikan pada 31 Maret 2027. Pelajari selengkapnya tentang penghentian fitur ini dan cara bermigrasi.

Sampel ini mencakup berbagai cara untuk memperbarui penyebaran Azure Cloud Service (dukungan yang diperpanjang) yang ada.

Menambahkan ekstensi ke Layanan Cloud yang sudah ada

Kumpulan perintah berikut menambahkan ekstensi Protokol Desktop Jarak Jauh (RDP) ke layanan cloud yang sudah ada bernama ContosoCS yang termasuk dalam grup sumber daya bernama 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

hapus semua ekstensi dari Layanan Cloud

Kumpulan perintah berikut menghapus semua ekstensi dari layanan cloud yang ada bernama ContosoCS yang termasuk dalam grup sumber daya bernama 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

Hapus ekstensi Desktop Jarak Jauh dari Cloud Service

Kumpulan perintah berikut menghapus ekstensi RDP dari layanan cloud yang ada bernama ContosoCS yang termasuk dalam grup sumber daya bernama 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

Memperluas/mengurangi kapasitas instans peran

The following set of commands shows how to scale-out and scale-in role instance count for cloud service named ContosoCS that belongs to the resource group named 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

Langkah berikutnya

Untuk informasi selengkapnya tentang Azure Cloud Services (dukungan yang diperluas), lihat Gambaran umum Azure Cloud Services (dukungan yang diperpanjang).