Giter Club home page Giter Club logo

deploy-to-azure-cli-extension's Introduction

Build Status

Deploy to Azure using GitHub Actions

GitHub Actions provides a powerful execution environment integrated into every step of your workflow enabling you to combine and customize your workflow. You can use GitHub actions to build Continous Integration (CI) and deployment (CD) pipelines that target Azure. Developers who are looking to set up their CI-CD pipelines will have to acquire the actions, fill in the required parameters and set up the secrets, to execute the workflows. How about we do all of that for you with a single command?

The Deploy to Azure extension alleviates developer pain in building workflows that target Azure by abstracting away the configuration pain and reducing concept count.

Installing the extension

The Deploy to Azure is distributed as an extension to Azure CLI. Follow the steps given below to install the extension.

  1. Install Azure CLI . You must have at least v2.0.60, which you can verify with az --version command.
  2. Add Deploy to Azure extension by running the command
    az extension add --name deploy-to-azure

Deploy to Azure Kubernetes Service

The az aks app up command builds the application container image, pushes the image to Azure Container Registry, and deploys the image to an Azure Kuberentes Service instance. Follow the steps below to get started.

  1. You need to be logged in to Azure CLI. Run the az login command.
    If the CLI can open your default browser, it will do so and load a sign-in page. Otherwise, you need to open a browser page and follow the instructions on the command line to enter an authorization code after navigating to https://aka.ms/devicelogin in your browser. For more information, see the Azure CLI login page.

  2. Run the command az aks app up and provide the GitHub repository URL
    az aks app up -r https://github.com/contoso/samplerepo
    Alternatively, you can run the command from within the local checkout of the repository and the repository URL will be inferred from the git context. If both are available, the command parameter takes precedence.

  3. Provide your GitHub credentials to generate a PAT token, which will be used to commit the configuration files. Alternatively, you can provide the PAT token directly as well.

  4. The command does a repository analysis to understand the language breakdown and also detect availability of any docker files.
    If a docker file is available, the docker file in the repository is used.
    In the absence of a docker file, the command generates a docker file based on the language split and depending on whether it can infer the build mechanism with high confidence. In the absence of the latter, the command will fail.

  5. Provide the ACR and AKS instances that you want to target.

  6. The command creates the required secrets in the GitHub repository.

  7. The command also generates the required helm charts and the action workflow file. The following configuration files are then committed into the GitHub repository, using the token generated in step 1.

    • Docker file and dockerignore if genereated.
    • Helm Charts
    • Action workflow file
  8. The workflow is created and kick started with the commit of the configuration files. You can monitor the status of the workflow run, from the CLI or use the URL provided to navigate to the GitHub workflow run view.

Deploy to Azure Container Instance

The az container app up command builds the application container image, pushes the image to an ACR and deploys the image to an Azure Container Instance. Follow the steps below to get started.

  1. You need to be logged in to Azure CLI. Run the az login command.
    If the CLI can open your default browser, it will do so and load a sign-in page. Otherwise, you need to open a browser page and follow the instructions on the command line to enter an authorization code after navigating to https://aka.ms/devicelogin in your browser. For more information, see the Azure CLI login page.

  2. Run the command az container app up and provide the GitHub repository URL
    az container app up -r https://github.com/contoso/samplerepo
    Alternatively, you can run the same command from within the local checkout of the repository and the repository URL will be inferred from the git context. If both are available, the command parameter takes precedence.

  3. Provide your GitHub credentials to generate a PAT token, which will be used to commit the configuration files. Alternatively, you can provide the PAT token directly as well.

  4. Provide the ACR instance that you want to target.

  5. The command sets up the required secrets in the GitHub repository.

  6. The command also generates the action workflow file. The following configuration files are then committed into the GitHub repository, using the token generated in step 1.

    • Docker file and dockerignore if genereated.
    • Action workflow file
  7. The workflow is created and kick started with the commit of the configuration files. You can monitor the status of the workflow run, from the CLI or use the URL provided to navigate to the GitHub workflow run view.

  8. The deployed application URL will be printed in CLI as well as the in the action after the workflow runs successfully.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

deploy-to-azure-cli-extension's People

Contributors

atbagga avatar geverghe avatar ishitam8 avatar microsoft-github-operations[bot] avatar microsoftopensource avatar mitsha-microsoft 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.