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
AADSSHLoginForLinuxVM extension installed. - An Entra account with the
Virtual Machine Administrator LoginorVirtual Machine User Loginrole configured for the VM. - Linux or WSL (Windows is not supported due to https://github.com/PowerShell/PowerShell/issues/24585).
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.
Use with scp
Use -S az-ssh to instruct scp to use az-ssh:
scp -S az-ssh testfile azure-vm.example.com:
Use with rsync
Use -e az-ssh to use az-ssh with rsync:
rsync -e az-ssh --progress testfile azure-vm.example.com:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file az_ssh_wrapper-1.0.3.post1.tar.gz.
File metadata
- Download URL: az_ssh_wrapper-1.0.3.post1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9566d9c88cb7f335a4f12d70c99b5c6348abf471d1f35db788b827124a4bf7c
|
|
| MD5 |
ca33b023fe06c1d05302cc7c8553d322
|
|
| BLAKE2b-256 |
66ce06696645e9a6ba775178b1a727b96ec967e894af5b21764c698a2640ecbd
|
Provenance
The following attestation bundles were made for az_ssh_wrapper-1.0.3.post1.tar.gz:
Publisher:
pypi.yml on swsphn/az-ssh-wrapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
az_ssh_wrapper-1.0.3.post1.tar.gz -
Subject digest:
a9566d9c88cb7f335a4f12d70c99b5c6348abf471d1f35db788b827124a4bf7c - Sigstore transparency entry: 229320180
- Sigstore integration time:
-
Permalink:
swsphn/az-ssh-wrapper@1f7b1408a3ad925e0795b017e7924f6c279bd773 -
Branch / Tag:
refs/tags/v1.0.3.post1 - Owner: https://github.com/swsphn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@1f7b1408a3ad925e0795b017e7924f6c279bd773 -
Trigger Event:
push
-
Statement type:
File details
Details for the file az_ssh_wrapper-1.0.3.post1-py3-none-any.whl.
File metadata
- Download URL: az_ssh_wrapper-1.0.3.post1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a72d37d82808bbd2c655ad3c4a9c3fdc66724d47742b21d939293e116548443
|
|
| MD5 |
883b7401eb78dbf0d241e4c053c60a71
|
|
| BLAKE2b-256 |
6d2c5ec3a068712814b923e2980f6a30edf9be640a239f03202974547a219eae
|
Provenance
The following attestation bundles were made for az_ssh_wrapper-1.0.3.post1-py3-none-any.whl:
Publisher:
pypi.yml on swsphn/az-ssh-wrapper
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
az_ssh_wrapper-1.0.3.post1-py3-none-any.whl -
Subject digest:
2a72d37d82808bbd2c655ad3c4a9c3fdc66724d47742b21d939293e116548443 - Sigstore transparency entry: 229320183
- Sigstore integration time:
-
Permalink:
swsphn/az-ssh-wrapper@1f7b1408a3ad925e0795b017e7924f6c279bd773 -
Branch / Tag:
refs/tags/v1.0.3.post1 - Owner: https://github.com/swsphn
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@1f7b1408a3ad925e0795b017e7924f6c279bd773 -
Trigger Event:
push
-
Statement type: