Εκπαίδευση
Λειτουργική μονάδα
Build a scalable application with Virtual Machine Scale Sets - Training
Enable your application to automatically adjust to changes in load while minimizing costs with Virtual Machine Scale Sets.
Αυτό το πρόγραμμα περιήγησης δεν υποστηρίζεται πλέον.
Κάντε αναβάθμιση σε Microsoft Edge για να επωφεληθείτε από τις τελευταίες δυνατότητες, τις ενημερώσεις ασφαλείας και την τεχνική υποστήριξη.
This article describes how to update the role size and instance count in Azure Cloud Services by using the allowModelOverride property. When you use this property, you don't need to update the service configuration (.cscfg) and service definition (.csdef) files. So you can scale the cloud service up, down, in, or out without repackaging and redeploying it.
You can set the allowModelOverride property to true
or false
.
When allowModelOverride is set to true
, an API call updates the role size and instance count for the cloud service without validating the values with the .csdef and .cscfg files.
Σημείωση
The .cscfg file will be updated to reflect the role instance count. The .csdef file (embedded within the .cspkg) will retain the old values.
When allowModelOverride is set to false
, an API call throws an error if the role size and instance count values don't match the values in the .csdef and .cscfg files, respectively.
The default value is false
. If the property is reset to false
after being set to true
, the .csdef and .cscfg files will again be validated.
The following samples show how to set the allowModelOverride property by using an Azure Resource Manager (ARM) template, PowerShell, or the SDK.
Setting the allowModelOverride property to true
here updates the cloud service with the role properties defined in the roleProfile
section:
"properties": {
"packageUrl": "[parameters('packageSasUri')]",
"configurationUrl": "[parameters('configurationSasUri')]",
"upgradeMode": "[parameters('upgradeMode')]",
"allowModelOverride": true,
"roleProfile": {
"roles": [
{
"name": "WebRole1",
"sku": {
"name": "Standard_D1_v2",
"capacity": "1"
}
},
{
"name": "WorkerRole1",
"sku": {
"name": "Standard_D1_v2",
"capacity": "1"
}
}
]
},
Setting the AllowModelOverride
switch on the new New-AzCloudService
cmdlet updates the cloud service with the SKU properties defined in the role profile:
New-AzCloudService `
-Name "ContosoCS" `
-ResourceGroupName "ContosOrg" `
-Location "East US" `
-AllowModelOverride `
-PackageUrl $cspkgUrl `
-ConfigurationUrl $cscfgUrl `
-UpgradeMode 'Auto' `
-RoleProfile $roleProfile `
-NetworkProfile $networkProfile `
-ExtensionProfile $extensionProfile `
-OSProfile $osProfile `
-Tag $tag
Setting the AllowModelOverride
variable to true
updates the cloud service with the SKU properties defined in the role profile:
CloudService cloudService = new CloudService
{
Properties = new CloudServiceProperties
{
RoleProfile = cloudServiceRoleProfile
Configuration = < Add Cscfg xml content here>
PackageUrl = <Add cspkg SAS url here>,
ExtensionProfile = cloudServiceExtensionProfile,
OsProfile= cloudServiceOsProfile,
NetworkProfile = cloudServiceNetworkProfile,
UpgradeMode = 'Auto',
AllowModelOverride = true
},
Location = m_location
};
CloudService createOrUpdateResponse = m_CrpClient.CloudServices.CreateOrUpdate("ContosOrg", "ContosoCS", cloudService);
The Azure portal doesn't allow you to use the allowModelOverride property to override the role size and instance count in the .csdef and .cscfg files.
Εκπαίδευση
Λειτουργική μονάδα
Build a scalable application with Virtual Machine Scale Sets - Training
Enable your application to automatically adjust to changes in load while minimizing costs with Virtual Machine Scale Sets.
Τεκμηρίωση
Deploy Azure Cloud Services (extended support) - Azure PowerShell
Deploy Azure Cloud Services (extended support) by using Azure PowerShell.
Azure Cloud Services (extended support) Def. WebRole Schema
Information related to the web role for Cloud Services (extended support)
Azure PowerShell samples - Update an Azure Cloud Service (extended support)
Sample scripts for updating Azure Cloud Service (extended support) deployments