Publishing Azure Cloud Services (extended support) from Visual Studio fails with "The language expression property 'slotType' doesn't exist"

291 views Asked by At

I'm following the official docs on publishing an Azure Cloud Services (extended support) instance from Visual Studio. However, publishing fails, with the following output:

22:25:06 - Uploading 'E:\Projects\MyCloudService\bin\Release\app.publish\MyCloudService.cspkg' as 'MyCloudService-3b0df582.cspkg' to storage account...
22:25:44 - Uploading 'E:\Projects\MyCloudService\bin\Release\app.publish\ServiceConfiguration.Cloud.cscfg' as 'ServiceConfiguration.Cloud-3b0df582.cscfg' to storage account...
22:25:44 - Checking if all the certificates exist in key vault 'https://mykeyvault.vault.azure.net/'...
22:25:46 - Preparing deployment for MyCloudService_2023-07-16T222446 with Subscription ID '...' using Resource Management URL 'https://management.azure.com/'...
22:25:46 - Starting...
22:26:12 - Deployment Status: Failed.
22:26:12 - The deployment through Azure Resource Management failed.
Code: DeploymentFailed
Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.
Detail: Unable to process template language expressions for resource '<resource ID>' at line '1' and column '8784'. 'The language expression property 'slotType' doesn't exist, available properties are 'loadBalancerConfigurations, swappableCloudService'.'

The publish profile does contain <AzureSlot>Production</AzureSlot> though, what VS added during this publish attempt (it wasn't there previously), but removing it or changing to <AzureSlot>Staging</AzureSlot> doesn't help.

This looks like an issue with an ARM template. There's a deployment template generated under bin\Release folder of the project, and a parameter file, and these indeed have references to slotType. Trying to fix this from generated files that are overwritten before the next publish anyway seems futile though.

The same happens if I create a new publish profile.

This used to work without issues in the first days of April (I know I published once successfully then). Now if I try to publish that old code, I get the same error. So I suspect a VS update broke it.

Anybody with some hints?

Also posted this to the Microsoft Developer Community in case it's a VS bug.

1

There are 1 answers

0
Piedone On

This is a VS bug, see this thread in the Microsoft Developer Community. According to Devin Breshears from Microsoft:

I think I have a theory on the root cause and will attempt to setup a repro and figure out a fix. I believe the template is looking for the Slottype property off of the networkProfile for the swappable cloud service. Since your swappable Cloud Service doesn’t have a SlotType yet, it fails.

VIP swap is definitely a different implementation than classic which had slots as you mentioned. The SlotType metadata on Cloud Services (extended support) was added well after initial release and required an API update in VS (17.6) with a bunch of logic for when a service has or doesn’t have slottype. Looks like we might have missed this one when we have a swappable pair setup earlier and neither have a slotType in their network profile, sorry about this.

You might be able to workaround, if you have the luxury to delete services and then recreate them. That should create the property we are looking for in the services. Line 271 seems to be the issue (at least that is my theory currently). This is where the template attempts to get the “swappable” Cloud Services networkProfile.slotType.

FWIW, I am working on a seperate issue where we also get IPaddress conflicts when deleting a staging service setup as a swappable pair, then recreating that service and deploying it from VS, setting it to swap with the production service. VS will unfortunately try to create an IPAddress name that is already in use , such as what you mentioned in the portal. If you keep both staging and production services running, you won’t hit this.