Skip to main content

SSH Wrapper for Azure CLI's `az ssh` command

Project description

Az SSH Wrapper

This package provides a wrapper script for the Azure CLI az ssh command. This makes it possible to use az ssh with programs which expect the standard SSH interface, such as Ansible. This is useful for example if you want to deploy an Ansible role to an Azure VM, and you want to automatically connect to the VM using az ssh, rather than needing to manage SSH keys, etc.

az-ssh accepts all the standard SSH arguments, and passes them on directly to az ssh.

It filters out the ControlMaster and ControlPersist options, as there is a known issue using these options with az ssh, which causes az ssh to block for the duration of the ControlPersist value. See the following GitHub issue for details:

https://github.com/Azure/azure-cli-extensions/issues/7285

Requirements

  • Azure CLI
  • An Azure VM with the AADSSHLoginForLinux VM extension installed.
  • An Entra account with the Virtual Machine Administrator Login or Virtual Machine User Login role configured for the VM.
  • Linux or WSL

Install from PyPI

Install with pip, pipx or uv tool.

pip install az-ssh-wrapper
pipx install az-ssh-wrapper
uv tool install az-ssh-wrapper

Install latest development version from GitHub

Install with pip, pipx or uv tool

pip install az-ssh-wrapper@git+https://github.com/swsphn/az-ssh-wrapper.git
pipx install az-ssh-wrapper@git+https://github.com/swsphn/az-ssh-wrapper.git
uv tool install az-ssh-wrapper@git+https://github.com/swsphn/az-ssh-wrapper.git

Note: While the package is called az-ssh-wrapper, the installed executable is called az-ssh.

Examples

If you can already connect to a VM using the following Azure CLI command, this wrapper will enable Ansible to connect in the same way:

az ssh vm --ip 1.2.3.4

For example, the above command using this wrapper is:

az-ssh 1.2.3.4

If you need to pass options or arguments to SSH, Azure CLI requires you to use the following syntax:

az ssh vm --ip 1.2.3.4 -- <options>

For example, to connect to the server, run the date command, then exit:

az ssh vm --ip 1.2.3.4 -- date

In contrast, Az SSH Wrapper allows you to use the standard SSH form:

az-ssh 1.2.3.4 date

Use with Ansible

After installing this package you can simply specify ansible_ssh_executable = az-ssh, and it will automatically connect to the VM using your Azure credentials with your existing Azure CLI login. For example, you could configure this as a variable in your hosts inventory file.

Project details


Download files

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

Source Distribution

az_ssh_wrapper-1.0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

az_ssh_wrapper-1.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file az_ssh_wrapper-1.0.2.tar.gz.

File metadata

  • Download URL: az_ssh_wrapper-1.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for az_ssh_wrapper-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3b8a9e478de4790b81776a7e646e4fe784b1c77d1af7ce85722e8b163aa8d5e2
MD5 119f2aaf2b1858206a13ba16c494c68f
BLAKE2b-256 2b67338aefade91b1b603b32f6a3a6d144ed5ac2fe24f40745120e35acd956cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for az_ssh_wrapper-1.0.2.tar.gz:

Publisher: pypi.yml on swsphn/az-ssh-wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file az_ssh_wrapper-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: az_ssh_wrapper-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for az_ssh_wrapper-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 beda58a9a31d6f75f0e063be071711f802cc4168e4c7b6e41571d80c29b3e704
MD5 5f148d6ffc521423bdefb5e30e4ebd29
BLAKE2b-256 c60a203e988c9cf5b515a3297fa519c951ddfb496963a984e5b586e3c38f4760

See more details on using hashes here.

Provenance

The following attestation bundles were made for az_ssh_wrapper-1.0.2-py3-none-any.whl:

Publisher: pypi.yml on swsphn/az-ssh-wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page