Hey @josh_centerx,
So unfortunately I am unable to replicate this issue in 2022.3.10936.
I have a very basic setup, we cant create an azure classic or extended service in our Azure portal as it wont let us. I managed to create a dummy Azure Subscription with a managed certificate in Octopus and then created a dummy Azure Cloud service target where I forced a healthy health check by editing the DB (this does not affect the variable replacement but was needed so I could set that project up with the Deploy an Azure Cloud Service step).
I downloaded a dummy cspkg file from the internet - Download Azure Cloud Service Package (I got the AO extra small one.
I then unzipped that and took the cspkg file out of there, I then created a ServiceDefinition.csdef file and pasted your XML in there. I then zipped both of those files up and uploaded them into Octopus.
I setup my project the way you have with the below as the target files for XML replacement:
**/*.csdef
**/*.cscfg
I then set the variable up in my project variables as you have.
When I go to deploy it does fail because of the fact my target is not actually present in Azure but I get this in my logs:
13:58:58 Verbose | Updating configuration settings...
13:58:58 Info | No settings that match provided variables were found.
13:58:58 Verbose | The file at C:\Octopus\Work\20230306135852-85-8\staging\ServiceDefinition\ServiceDefinition.csdef does not match any known filename patterns. The file will be tried as multiple formats and will be treated as the first format that can be successfully parsed.
13:58:58 Verbose | The registered replacers we will try, in order, are: JsonFormatVariableReplacer,XmlFormatVariableReplacer,YamlFormatVariableReplacer,PropertiesFormatVariableReplacer
13:58:58 Verbose | Attempting structured variable replacement on file C:\Octopus\Work\20230306135852-85-8\staging\ServiceDefinition\ServiceDefinition.csdef with format Json
13:58:58 Verbose | The file at C:\Octopus\Work\20230306135852-85-8\staging\ServiceDefinition\ServiceDefinition.csdef couldn't be parsed as Json: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
13:58:58 Verbose | Attempting structured variable replacement on file C:\Octopus\Work\20230306135852-85-8\staging\ServiceDefinition\ServiceDefinition.csdef with format Xml
13:58:58 Verbose | Structure found matching the variable '/*:ServiceDefinition/*:WebRole/@vmsize'. Replacing its content with the variable value.
13:58:58 Info | Structured variable replacement succeeded on file C:\Octopus\Work\20230306135852-85-8\staging\ServiceDefinition\ServiceDefinition.csdef with format Xml
13:59:01 Verbose | Re-packaging cspkg.
This suggests this does indeed work in 2022.3.10936 with the Deploy an Azure Cloud Service step.
I am not sure why yours does not work and is not finding the structure for /*:ServiceDefinition/*:WebRole/@vmsize
.
The only thing I can think here is you mentioned you use pre and post deployment scripts for those files. I am wondering if that is interfering with the structured variable replacement not being able to see the <WebRole name="WebRole" vmsize="Small">
value to change it to Medium.
Would it be possible to get that pre and post deployment script, you can use the same upload link Kenny sent you in his 2nd March response. If I had that I can see if thats affecting the variable replacement. Let me know if you are able to send me that and if you are when you have sent it as we are not notified when a user uploads to that secure site.
Kind Regards,
Clare