title: How to deploy nodeJs app from Bitbucket to Azure
body: <p>Bitbucket has from some time ago availability of <a href="https://bitbucket.org/product/features/pipelines" rel="nofollow noreferrer">Pipelines</a> and I've been strugling, not from the Bitbucket part, but the Azure part as I can't find an easy way to deploy.</p>
  
  <p>in my BitBucket, I have a <code>bitbucket-pipelines.yml</code> with</p>
  
  <pre><code>image: node:8.9.4
  
  pipelines:
    default:
      - step:
          name: Build and test
          caches:
            - node
          script: # install packages and run tests
            - npm install
            - npm test
      - step:
          name: Deploy to Azure
          script:
            - git push https://$AZURE_LOGIN:$AZURE_PASSWORD@$AZURE_APP_NAME.scm.azurewebsites.net/$AZURE_APP_NAME.git master
  </code></pre>
  
  <p>and all works well from BB part, issue is that the code sent to Azure, from that command line is the application source, and I can't find an easy way to tell Azure to run <code>npm install</code> and I end up with <strong>Internal Server Error</strong> where a package was not found when I try to run the website after being deployed ...</p>
  
  <p>I've then created a VSTS account to configure <strong>Continuous Delivery</strong> in both parts... the option CD in Azure portal as well create a pipeline in VSTS...</p>
  
  <hr>
  
  <p>(through Azure portal directly)
  <a href="https://i.stack.imgur.com/bn9l9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bn9l9.png" alt=""></a></p>
  
  <hr>
  
  <p>(manually from VSTS)
  <a href="https://i.stack.imgur.com/G7SoX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G7SoX.png" alt=""></a>
  </p>
  
  <hr>
  
  <p>My question is simple... in order to avoid anything from Azure portal (seems to complicate at the moment, or it's just me as I'm more used to work with AWS and Heroku), is there a way to actually deploy from BitBucket automagically? </p>