This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Generate SSH config file from Azure ARM VM inventry in subscription

Project Description

Generate SSH config file from Azure ARM VM inventry in subscription

Introduction

azuresshconfig is a simple script that collects Azure ARM Virtual Machine(VM) inventry in subscription and generate a SSH config entries to be appended to $HOME/.ssh/config (the file is newly created if no exist). This is like an Azure version of ec2ssh or aws-ssh-config that strongly inspired this initiative. This would be very helpful when you manage lots of VMs that have dynamic IP assignment settings and need frequent VM up-and-down operations for them which causes the change of IPs assigned to VMs. In such a case, azuresshconfig will definitly make your SSH life easy.

Installation

pip install azuresshconfig

Configuration

Generate client profile template file by executing the following command.

azuresshconfig --init

Configure the client profile file, in which you add your service principal account info to access your resources in Azure via Azure APIs.

vi $HOME/.azure/azuresshconfig.json

{
    "subscription_id": "<YOUR SUBSCRIPTION ID>",
    "client_id": "<YOUR APPLICATION CLIENT IP>",
    "client_scret": "<YOUR APPLICATION CLIENT SCRET>",
    "tenant_id": "<YOUR TENANT ID>"
}

For those who don’t know how to create service principal, there is a great instruction: Use Azure CLI to create a service principal to access resources. If you have Azure CLI 2.0 command installed on your evironment, you can create your service principal and configure its access to your azure resources with a single command ‘az ad sp create-for-rbac’.

Suppose your app id uri is ‘http://unofficialism.info’ and role you want to give for the app is ‘Reader’, you can create your service principal like this:

az ad sp create-for-rbac -n "http://unofficialism.info" --role reader

You will get an output like this, and with them you can fill out the client profile file:

{
  "appId": "c36x4b4f-bef6-422e-bd3b-65057e7ab065",        # -> client_id in client profile file
  "displayName": "azure-cli-2017-03-30-05-16-59",
  "name": "http://unofficialism.info",
  "password": "32126d32-7453-4053-3353-c420d4ffef2e",     # -> client_scret in client profile file
  "tenant": "72f988bf-86f1-41af-91cb-2d7cd011db47"        # -> tenant_id in client profile file
}

For the detail of service principal role, please refer to Built-in roles for Azure Role-Based Access Control.

Usage

Assuming all required packages are installed and rightly configured, you’re ready to run azuresshconfig

“` azuresshconfig –help

usage: azuresshconfig.py [-h] [–version] [–init] [–profile PROFILE] [–output OUT

Release History

Release History

This version
History Node

0.3.0

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.1

History Node

0.1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
azuresshconfig-0.3.0-py2.py3-none-any.whl (39.9 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Apr 29, 2017
azuresshconfig-0.3.0.tar.gz (11.4 kB) Copy SHA256 Checksum SHA256 Source Apr 29, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting