Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.Note
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.
- View the deployment prerequisites for Cloud Services (extended support).
- View frequently asked questions for Cloud Services (extended support).