Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to fail deployment on failed VM runCommands #1552

Open
matferrari-msft opened this issue May 3, 2023 · 5 comments
Open

Ability to fail deployment on failed VM runCommands #1552

matferrari-msft opened this issue May 3, 2023 · 5 comments

Comments

@matferrari-msft
Copy link
Member

When deploying a VM, I use a run command in my bicep template to it. I cannot use cloud-init because the commands need to run after the extensions have been successfully added. A run command will successfully provision regardless of the exit status of the script. It would be nice to have a way to fail the deployment if the runCommand.properties.instanceView.exitStatus was not 0. Otherwise, the deployment succeeds and I think everything is good to go, when in reality the configuration failed. Below is an example:

resource configPart1 'Microsoft.Compute/virtualMachines/runCommands@2022-11-01' = {
  name: 'configPart1'
  parent: vm
  location: location
  properties: {
    protectedParameters: [{
        name: VAR_1
        value: VALUE_1
    }]
    source: {
      script: '/oops'
    }
  }
}

if (configPart1.properties.instanceView.exitStatus) {
    throw error
}
@matferrari-msft matferrari-msft added the enhancement New feature or request label May 3, 2023
@ghost ghost added the Needs: Triage 🔍 label May 3, 2023
@anthony-c-martin
Copy link
Member

Feels related to Azure/bicep#2405

@stephaniezyen
Copy link
Contributor

We will track the improvement on the issue linked, but will also route it to the VM Resource Provider.

@stephaniezyen stephaniezyen transferred this issue from Azure/bicep May 3, 2023
@ghost
Copy link

ghost commented May 4, 2023

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @TravisCragg-MSFT, @nikhilpatel909, @sandeepraichura, @hilaryw29, @GabstaMSFT. Please see https://aka.ms/biceptypesinfo for troubleshooting help.

Issue Details

When deploying a VM, I use a run command in my bicep template to it. I cannot use cloud-init because the commands need to run after the extensions have been successfully added. A run command will successfully provision regardless of the exit status of the script. It would be nice to have a way to fail the deployment if the runCommand.properties.instanceView.exitStatus was not 0. Otherwise, the deployment succeeds and I think everything is good to go, when in reality the configuration failed. Below is an example:

resource configPart1 'Microsoft.Compute/virtualMachines/runCommands@2022-11-01' = {
  name: 'configPart1'
  parent: vm
  location: location
  properties: {
    protectedParameters: [{
        name: VAR_1
        value: VALUE_1
    }]
    source: {
      script: '/oops'
    }
  }
}

if (configPart1.properties.instanceView.exitStatus) {
    throw error
}
Author: matferrari-msft
Assignees: -
Labels:

enhancement, Needs: Triage :mag:, Service Attention, Compute - VM

Milestone: -

@nikhilpatel909
Copy link

ack, reviewing it

@matferrari-msft
Copy link
Member Author

@nikhilpatel909 Is there an update on this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

4 participants