question

AlexOlshanetsky-7262 avatar image
1 Vote"
AlexOlshanetsky-7262 asked ·

Azure deployment cfn-signal equivalent?

I am utilizing cloud-init for my deployments both in AWS and Azure.

In AWS I can signal success/failure using cfn-signal to my CloudFormation stack. In Azure I have not found anything similar.

Example cloud-init:

 #cloud-config
 write_files:
   - path: /etc/my_script.sh
     permissions: '0775'
     content: |
       #!/bin/bash
       set -Eeuo pipefail
    
       trap error_report ERR
    
       error_report() {
         # Some error reporting stuff, including
         cloud-init collect-logs
         # Send them somewhere
         # cfn-signal -e 1 # Present in AWS-version only
       }
    
       echo 'This is a successful command'
       # some other commands that might fail
       cfn-signal -e 0     # Present in AWS-version only
 runcmd:
   - [ bash, /etc/my_script.sh ]


Failing runcmd does not fail the whole cloud-init configuration. I am missing the piece where I can somehow signal the deployment either a success or failure. Failure would be enough, really.

Any help is greatly appreciated. Thanks in advance.

azure-virtual-machines
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

jakaruna-MSFT avatar image
0 Votes"
jakaruna-MSFT answered ·

Its not supported.

Please upvote this feedback https://feedback.azure.com/forums/216843-virtual-machines/suggestions/32815405-please-add-wait-condition-capabilities-in-arm-temp
so that product teams takes this into backlog and work on it.

But you have a lengthy workaround. You can have a custom script extension along with the cloud init.
In the custom script extension , you can have a loop to check for the required condition for the specified time.
Once the conditions achieved, Then you can exit the script with 0 exit code. If that times out or fails, Then exit the script with failure exit code. With that you can identify in ARM template

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.