Azure: previous deployment from ‘MM/dd/yyyy hh:mm:ss’ is still active

Another helpful Azure error message:

I have a master template with linked templates. The whole child template (linkedTemplate-VM), which deploys the actual VM, is iterated X number of times, using CopyIndex(), instantiated in the master template. (Where X is the number of VMs I want). When I increased X from 1 to 2, I started getting this error. The reason is that Azure will deploy each copy simultaneously and as “linkedTemplate-VM” was already running for the first VM, it couldn’t run a second time. The solution is to give it a unique name.

The problem I had was that “linkedTemplate-VM” was actually a child of a child template and the copyIndex() function was instantiated in the parent template. The answer is to save the copyIndex() value into a variable in the template where copyIndex() is first instantiated and pass that variable down to the siblings.

In the following example, I declare the variable properties.parameters.seqNo, and it’s value is copyIndex (with padding and an offset. Padding so it resolves as 001, 002… and the offset of 1 is so that it starts counting from 1 as opposed to the default 0).


In the next level, I retrieve the variable in the parameters block and use it in the name of the linked template (line 14):



Please feel free to leave a comment...