Azure deployment cfn-signal equivalent?

Alex Olshanetsky 6 Reputation points
2020-02-12T09:33:28.377+00:00

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
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,180 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. jakaruna-MSFT 601 Reputation points Microsoft Employee
    2020-02-14T05:32:04.403+00:00

    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

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.