Git Product home page Git Product logo

azure-utilities's Introduction

azure-utilities

This is a home for a few Azure-specific utilities that I find useful

StartVirtualMachine

Starts a virtual machine by name

  • Runs as an Azure Function
  • Starts any VM in your Azure subscription by name
  • Immediately provides connection information
    • Linux: redirects and/or provides a link to ssh://<username>@<FQDN>
    • Windows: downloads an .rdp file to connect
  • Only has access to the permissions you grant to its Service Principal

StartVSTSBuildAgent / StopVSTSBuildAgent

Creates or destroys an Azure Container Instance that runs the VSTS Build Agent

  • Dockerfile is in the vsts-build-agent folder
  • Creates Container Groups in the vsts Resource Group
  • You'll need to provide AppSettings in your Function App for VSTS_AGENT_INPUT_URL and VSTS_AGENT_INPUT_TOKEN
  • Places VSTS agents in a pool named AzureContainerInstance
  • Uses the same Service Principal as the other Functions to interact with your Azure Subscription

Setup

# Create a Service Principal
az ad sp create-for-rbac -n utility-functions

Update Resources/azuredeploy.parameters.json with your values

  • Use the appId value for servicePrincipalClientId
  • Use the password value for servicePrincipalClientSecret
...
    "name": {
      "value": "my-utility-functions"
    },
    "servicePrincipalTenantId": {
      "value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    },
    "servicePrincipalClientId": {
      "value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    },
    "servicePrincipalClientSecret": {
      "value": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
  }
...

Create a function app in Azure

# Create a resource group
az group create -n utility-functions -l westus2

# Deploy the ARM template to create a function app
az group deployment create -g utility-functions --template-file Resources/azuredeploy.json --parameters @Resources/azuredeploy.parameters.json

Click here if you just want to deploy the template in a hurry

Publish the function to Azure

  • Open azure-utilities.sln in VS2017
  • Right-click the Functions project
  • Hit Publish and select your your newly created function app

The azure-functions-core-tools on Linux were very new and weren't working reliably when I wrote this - if it's been a while, I'd try that first instead of full Visual Studio

azure-utilities's People

Contributors

noelbundick avatar

Watchers

 avatar  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.