Search code examples
c#azuredeploymentazure-service-fabricazure-rm-template

How to remove a "remembered" extension previously included via provisionAfterExtensions?


I'm working on a solution running a Service Fabric Cluster, defined using ARM templates.

I did some experimenting in which I included the extensions KVVMExtension to two virtual machine scale sets using ARM-templates. These are intended to load data from a keyvault at an early point. As part of that process, I added these extentions under provisionAfterExtensions under my ServiceFabricNode-extensions (in order to ensure that reading from the keyvault happens before other extensions are provisioned):

"virtualMachineProfile": {
      "extensionProfile": {
          "extensions": [
           {
              "name": "[concat('ServiceFabricNodeVmExt','_vmNodeType0Name')]",
              "properties": {
              "type": "ServiceFabricNode",
              "provisionAfterExtensions" : ["KVVMExtension"],
              (...)

Now I just tried to roll back this experiment, and remove any mention of the KKVM-extension, including the reference to it shown in the last line of code above, but the build keeps failing with the following error:

BadRequest: On resource 'nt1vm', extension 'ServiceFabricNodeVmExt_vmNodeType0Name' specifies 'KVVMExtension' in its provisionAfterExtensions property, but the extension 'KVVMExtension' will no longer exist. First, remove the extension 'ServiceFabricNodeVmExt_vmNodeType0Name' or remove 'KVVMExtension' from the provisionAfterExtensions property of 'ServiceFabricNodeVmExt_vmNodeType0Name'

I found this a little strange, as all references to KVVM have been removed now; apparently some part of the Service Fabric setup "remembers" the previous dependency, and will not let me remove it.

I tried updating the ARM template with some other minimal changes, just to be 100% certain that it was actually picked up and registered as changed by the Azure DevOps build pipeline which runs it, but this made no difference.

I also tried to delete the KVVM extension from within the Azure portal, but that was prohibited precisely because it was specified under provisionAfterExtensions for the other extension. I cant delete the other extension without deleting the whole VM Scale set, which I would rather not do at this point.

Is there any other way I can go about removing this apparently "remembered" dependency between extensions?


Solution

  • Turns out there was a simple solution to this problem.

    I had attempted to simply remove the following line from my ARM template, believing that that would also remove the dependency between the two extensions:

    "provisionAfterExtensions" : ["KVVMExtension"],
    

    Instead, what I needed to do was change the line, so that it remained, but explicitly provided an empty array:

    "provisionAfterExtensions" : [],
    

    After I ran my build pipeline with this change, the problem was gone.