4
votes

I am using ARM Templates to deploy cloud service. Once deploy to staging slot I activate it which triggers the VIP swap.

When I want to rollback and switch staging and production stage we I again the part that activate the staging.

Problem is that it requires me to know what is the deployment label in the staging slot.

"resources" : [{
        "apiVersion" : "2014-06-01",
        "type" : "Microsoft.ClassicCompute/domainNames",
        "name" : "[parameters('serviceDomainName')]",
        "location" : "[variables('resourceLocation')]",
        "resources" : [{
                "apiVersion" : "2015-12-01",
                "name" : "[parameters('deploymentLabel')]",
                "type" : "active",
                "dependsOn" : [
                    "[resourceId('Microsoft.ClassicCompute/domainNames', parameters('serviceDomainName'))]",
                ],
                "properties" : {}
            }
        ]
    }
]

Is there a way to force a swap without knowing the deployment label?

Documenation talks about using: https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.ClassicCompute/domainNames/{domainName}/swap

But I could not make it work in the template, since all actions are always type/name and here I have only type.

1
did you try reference function?4c74356b41
@4c74356b41 I am not familar with that. Can you give me some reference? How do I use thoe functions?Igal S.

1 Answers

-1
votes

If you've only got two deployment slots and have stuck to a standard naming convention, this should be achievable as you only need to supply the source slot name when switching with the Production slot.

If you've got more than two deployment slots and/or if you haven't kept to a naming convention, you won't be able to produce one hard-coded ARM template to do the swap. The caveat to that of course is that if you do know what your slots are called, you can simply parameterise it, providing you with one generic slot swap template.