amyspark
amyspark

Reputation: 520

Deploy Azure web app with private credentials via Git

I would like to deploy my Node.js app via GitHub to Azure.

I intend to make the app open source, thus no private info would be published in the repo; however, I still need to push the necessary credentials, API keys, etc. for the app to connect to other services.

How can I deploy the app without resorting to the private Git endpoint, and then awkward copy-pasting between the repos?

Upvotes: 0

Views: 369

Answers (4)

Peter Pan
Peter Pan

Reputation: 24148

Your issue seems to be continuous deployment for Web App via Git from GitHub repo. So I think @Dark Falcon 's answer is correct.

Azure continuous deployment support GitHub just need to do OAuth authentication in Azure Portal.

Find out the link "set up deployment from source control" at Azure WebApp Dashboard page and do it step by step, as the pictures below.

enter image description here enter image description here enter image description here

There is some blogs and vedio tutorials for details of helping you.

The blog explains how to use continuous deployment support for repo hosted on GitHub http://azure.microsoft.com/en-us/blog/using-app-service-web-apps-continuous-deployment-with-github-organizations/.

You also can follow these vedio tutorials to try to do it, as the references below.

  1. http://azure.microsoft.com/en-us/documentation/videos/create-a-nodejs-site-deploy-from-github/
  2. http://azure.microsoft.com/en-us/documentation/videos/deploying-to-azure-from-github/
  3. https://channel9.msdn.com/Series/Windows-Azure-Web-Sites-Tutorials/Github-Continuous-Delivery-in-the-Preview-Portal.

Best Regards.

Upvotes: 0

Ryan Joy
Ryan Joy

Reputation: 3039

Typically you'll want to utilize an npm module like nconf to load environment variables from either a file or environment variables. enter image description here

config.json is just a JSON document listing your key:value pairs. You'll want to add config.json to your .gitignore file to ensure you don't share your credentials publically. enter image description here

Within the Azure Portal, you'll want to add your credentials as key:value pairs under Application Settings. enter image description here

Note: You may be wondering what will happen if config.json is not found. nconf will simply move on to the next chained option. You could continue to chain config options together as in the following code snippet:

var nconf = require('nconf');

// Create nconf environtment 
nconf 
    .file({ file: 'config.json' })  // Committed to repo; public settings
    .file({file: 'local_config.json'})  // Not committed to repo; private or dev environment settings
    .env();

Upvotes: 1

MrBink
MrBink

Reputation: 740

Set configuration as environment variables found in the "App Settings" section under Settings->Application Settings. Rationale here.

Upvotes: 0

Dark Falcon
Dark Falcon

Reputation: 44201

Persistent data can be stored under d:\home, so I would recommend placing your private customizations there. If they need to be applied to the site in some way, you should do this by writing a deployment hook.

Upvotes: 0

Related Questions