تحديث خدمة سحابة Azure (دعم موسع)

تُغطي هذه العينات طرقاً مختلفة لتحديث نشر خدمة سحابة Azure (الدعم الموسع) الموجود.

إضافة امتداد إلى خدمة السحابة الحالية

تضيف مجموعة الأوامر أدناه امتداد RDP إلى خدمة سحابية موجودة بالفعل تسمى ContosoCS تنتمي إلى مجموعة الموارد المُسماة 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

إزالة كافة الامتدادات من خدمة السحابة

تقوم مجموعة الأوامر أدناه بإزالة كافة الامتدادات من خدمة السحابة الحالية المسماة ContosoCS والتي تنتمي إلى مجموعة الموارد المسماة 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

إزالة امتداد سطح المكتب البعيد من خدمة السحابة

تُزيل مجموعة الأوامر أدناه امتداد RDP من خدمة السحابة الحالية المسماة ContosoCS التي تنتمي إلى مجموعة الموارد المسماة 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

حالات الدور على نطاق واسع/ مقياس

توضح مجموعة الأوامر أدناه كيفية توسيع نطاق عدد من الأدوار وتوسيع نطاقه للخدمة السحابية المسماة ContosoCS التي تنتمي إلى مجموعة الموارد المسماة 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

الخطوات التالية

لمزيد من المعلومات حول خدمات سحابة Azure (الدعم الموسع)، راجع نظرة عامة حول خدمات سحابة Azure (الدعم الموسع).