Giter VIP home page Giter VIP logo

afvmpowermonitor's Introduction

afVmPowerMonitor

c# azure function v2 to monitor and deallocate virtual machine and kusto resources at specified consecutive powered on count

afVmPowerMonitor is an azure function to monitor virtual machine and kusto power states and deallocate after specified amount of time. available are include and exclude filters for different resource types for more granular control. this is useful only for test / repro environments and not production.

this template deploys the following resources:

  • .net framework azure function v2 (default cheapest / free)
  • storage account v2

required:

  • an existing or new azure application client id and secret for function authentication
    • application client id and secret are an azure AD application and service principal name which is required for any application authenticating to azure in a non-interactive environment. there are multiple ways to create azure id and secret. one way is to copy the command below into admin powershell prompt and execute to create client id and secret. this will generate a self signed certificate on the local machine from where it is run. the certificate thumbprint will be used when creating the azure spn.
    • if needed, use one of the following options to generate a new client id and secret, save output, and use values when deploying template:
iwr "https://raw.githubusercontent.com/jagilber/powershellScripts/master/azure-rm-create-aad-application-spn.ps1"| iex

optional:

  • sendgrid api key for email notifications . NOTE: sendgrid account is free for 100 emails / day
    sendgrid signup
  • to disable checks for virtual machines, virtual machine scale sets, and / or kusto, remove the corresponding include filters '.' from configuration during deploy or afterwards in application settings.

optional post deployment:

  • enable static website for use in browser or querying json from powershell for example.
  • NOTE: regardless of storage account and blob permissions, enabling this website will allow anonymous read access to the files below that could be considered sensitive information and therefore is not recommended!
    • to enable, after deployment, in portal, navigate to storage account, select 'static web sites', 'enable', and 'save'.
    • navigate to url for static web site.
    • there are two .json files
      • running.json
      • all.json

click button below to deploy

portal template settings

portal flow

afvmpowermonitor's People

Contributors

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