Giter Site home page Giter Site logo

apwestgarth / slingshot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from projectkudu/slingshot

0.0 2.0 0.0 2.33 MB

This project implements the Deploy To Azure button

Home Page: http://azure.microsoft.com/blog/2014/11/13/deploy-to-azure-button-for-azure-websites-2/

C# 63.15% HTML 10.75% CSS 2.01% JavaScript 23.23% ASP 0.06% PowerShell 0.68% Batchfile 0.12%

slingshot's Introduction

SlingShot

SlingShot is a service that enable one click deploy your web app from your repository to Azure App Service

All you need to do is place below markdown to your README.md file.

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://azuredeploy.net/)

or HTML if you like

<a href="https://azuredeploy.net/" target="_blank">
    <img src="http://azuredeploy.net/deploybutton.svg"/>
</a>

Advance configuration

Behind the scene, azuredeploy.net get the repository url from referal url and redirect request to deploy.azure.com. And some of the query strings from repository url will be honored. We can utilize these query strings for advance configuration.

Github (public repository only)

  • Deploy with linking paramater (Only if there is a azuredeploy.json at the root of your repository)
  • Query string "ptmpl" : any public url pointing to parameter json file or relative path from current repository
[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://deploy.azure.com/?repository={your repo url}?ptmpl={url to paramter json file or relative path from current repo})

e.g

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://deploy.azure.com/?repository=https://github.com/shrimpy/ArmParamterTemplateTest?ptmpl=https://raw.githubusercontent.com/shrimpy/ArmParamterTemplateTest/master/parameters.azuredeploy.json)

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://deploy.azure.com/?repository=https://github.com/shrimpy/ArmParamterTemplateTest?ptmpl=parameters.azuredeploy.json)

Bitbucket (public and private repository)

  • Deploy with linking paramater (Only if there is a azuredeploy.json at the root of your repository)
  • Query string "ptmpl" : any public url pointing to parameter json file or relative path from current repository

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://deploy.azure.com/?repository={your repo url}?ptmpl={url to paramter json file or relative path from current repo})

e.g 

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://localhost:44300/?repository=https://bitbucket.org/shrimpywu/armparametertemplatetest?ptmpl=https://bitbucket.org/shrimpywu/armparametertemplatetest/raw/master/parameters.azuredeploy.json)

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://localhost:44300/?repository=https://bitbucket.org/shrimpywu/armparametertemplatetest?ptmpl=parameters.azuredeploy.json)
  • Deploy from a pull request
  • Query string "pr" : pull request id
[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://localhost:44300/?repository={repository url}?pr={pull request id})

e.g

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://localhost:44300/?repository=https://bitbucket.org/shrimpywu/armparametertemplatetest?pr=1)
  • Enable continues deployment
  • Query string "manual" : true/false, default is false. Require single-sign-on with Azure.
[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://localhost:44300/?repository={repository url}?manual={true/false})

e.g

[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://localhost:44300/?repository=https://bitbucket.org/shrimpywu/armparametertemplatetest?manual=true)
  • Combine query strings
[![Deploy to Azure](http://azuredeploy.net/deploybutton.svg)](https://localhost:44300/?repository=https://bitbucket.org/shrimpywu/armparametertemplatetest?ptmpl=https://bitbucket.org/shrimpywu/armparametertemplatetest/raw/master/parameters.azuredeploy.json&pr=1)

Instructions for how to run SlingShot locally

  1. Clone this repository to your local drive.
  2. Open slingshot.sln with VS 2012+ and compile.

Create AAD application

  1. Go to Azure Portal while logged in as an Org ID (i.e. not MSA) and create AAD Application. You may create an application on existing AAD directory or a new directory altogether.
  2. Select Add an application my organization is developing
  3. Enter any name for application name.
  4. Select WEB APPLICATION AND/OR WEB API
  5. Enter https://localhost:44306/ as SIGN ON URL
  6. For APP ID URL, enter something like https://davidebboslingshot.onmicrosoft.com/.
  7. Once created, click CONFIGURE tab
  8. On Permission to other applications, add Windows Azure Service Management API and check Access Azure Service Management for Delegated Permissions and save.

Fix AADClientId and AADClientSecret in codes

  1. Copy CLIENT ID and paste it in this line, replacing Environment.GetEnvironmentVariable("AADClientId").
  2. On Keys section, create a client secret. Copy the key and paste it in the same file, replacing Environment.GetEnvironmentVariable("AADClientSecret").

Or as a cleaner alternative, you can set the AADClientId and AADClientSecret environment variables on your machine so that the code picks it up without having to modify it.

Test with localhost

  1. In VS, make Slingshot.Api the starter project. The RedirectionSite project can be ignored.
  2. Starting running it in the debugger (F5).
  3. In browser, it should redirect to login page.
  4. Enter AAD account and password. Note: try account that is not in the same directly as the application. Note: currently this does not work with MSA account.
  5. You should be prompt with OAuth allow/deny page, do accept it.

Test ARM apis

  1. https://localhost:44306/api/token - show current token details.
  2. https://localhost:44306/api/tenants - show all tenants (AAD directory) user belongs to.
  3. https://localhost:44306/api/tenants/<tenant-id> - to switch tenant.
  4. https://localhost:44306/api/subscriptions - list subscriptions.
  5. https://localhost:44306/api/subscriptions/<sub-id>/resourceGroups - list resourceGroups for a subscription.
  6. https://localhost:44306/api/subscriptions/<sub-id>/resourceGroups/<resource>/providers/Microsoft.Web/sites - list sites.
  7. and so on..

Test with Azure Websites

  1. Create Azure Websites with local git publishing enabled
  2. Add the site https url as the reply URL for AAD application
  3. Deploy the website by pushing the repository
  4. Set AADClientID and AADClientSecret appSettings
  5. To test, simply browse to the website and append the query string "?repository="

Any issue, do let me know.

slingshot's People

Contributors

ehamai avatar davidebbo avatar thauburger avatar ahmelsayed avatar suwatch avatar shrimpy avatar

Watchers

James Cloos avatar Andrew Westgarth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.