Fetch AKS kubeconfig and merge into ~/.kube/config by alias
Project description
azaks-conn
Fetch AKS kubeconfig and merge into ~/.kube/config by alias
Install
pip install azaks-conn
The package installs two console scripts that point at the same Typer app:
| Command | Use when |
|---|---|
azaks-conn |
Long form, friendly for scripts |
aksc |
Short alias for interactive shell use |
Usage
aksc --help
aksc --version
Four commands cover the alias lifecycle:
| Command | Purpose |
|---|---|
aksc connect CLUSTER [--alias NAME] [--resource-group RG] [--subscription SUB] [--admin] [--overwrite] |
Fetch AKS credentials and merge into ~/.kube/config under the given alias. |
aksc list |
Rich-table inventory of aksc-managed aliases (with provenance metadata). |
aksc verify ALIAS [--timeout N] |
Probe the alias's API server via kubectl cluster-info. |
aksc rm ALIAS [--force] |
Remove the alias from ~/.kube/config, the snapshot directory, and the state file. |
State lives in two places under ~/.kube/azaks-conn/:
<alias>— a single-context kubeconfig snapshot for each managed alias (mode0600)..aliases.json— JSON metadata (cluster, RG, subscription, admin flag, timestamp), used bylistandverify.
Security model
aksc connect shells out to az aks get-credentials. By default this fetches
an Entra ID (AAD) integrated kubeconfig: actual authentication still flows
through kubelogin and your Azure identity, and cluster RBAC applies.
The --admin flag passes through to az aks get-credentials --admin, which
returns a cluster-admin certificate in the kubeconfig. This bypasses Entra
ID and RBAC entirely — anyone with the file is cluster-admin until the
certificate expires (typically months).
aksc makes admin contexts visually obvious so they aren't accidentally
shared, committed, or left lying around:
aksc connect --adminprints a yellowwarning:line citing the bypass.aksc listflags the alias with a redADMINmarker in the Admin column.aksc verify <admin-alias>reprints the warning after each probe.- Both the merged entry in
~/.kube/configand the per-alias snapshot under~/.kube/azaks-conn/are written with mode0600.
Guidance:
- Prefer the default (AAD) flow whenever possible.
- Only use
--adminfor cluster bootstrap / break-glass work. - Treat any
--adminkubeconfig as a high-privilege secret — do not check it into source control, share it over chat, or copy it to shared hosts. aksc rm <admin-alias>is the fastest way to revoke local access; for full revocation, rotate the cluster admin credentials in Azure.
Development
git clone https://github.com/NaeemH/azaks-conn.git
cd azaks-conn
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install
# Run the standard checks
ruff check . && ruff format --check .
mypy src
pytest -q
Release
Releases are tag-driven. Bump src/azaks_conn/__about__.py, commit, then:
git tag v0.2.1
git push origin v0.2.1
.github/workflows/release.yml builds the sdist + wheel and publishes to PyPI
via Trusted Publishers (OIDC) — no API tokens involved.
License
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 azaks_conn-0.2.1.tar.gz.
File metadata
- Download URL: azaks_conn-0.2.1.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5068f8795f42dd8542720355b28bc8b489d7bdedacba72fe6fae338b1907160
|
|
| MD5 |
ab45c5cd2ba44ff429cb315b212d9beb
|
|
| BLAKE2b-256 |
9b881fbc47276cb442a1bead1d1f5bf7d1c9c97bc441535ce9516a608251ebae
|
Provenance
The following attestation bundles were made for azaks_conn-0.2.1.tar.gz:
Publisher:
release.yml on NaeemH/azaks-conn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
azaks_conn-0.2.1.tar.gz -
Subject digest:
a5068f8795f42dd8542720355b28bc8b489d7bdedacba72fe6fae338b1907160 - Sigstore transparency entry: 1930129826
- Sigstore integration time:
-
Permalink:
NaeemH/azaks-conn@7fad1d39cf286a343c5fc210ab1d6c02b6ece592 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/NaeemH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7fad1d39cf286a343c5fc210ab1d6c02b6ece592 -
Trigger Event:
push
-
Statement type:
File details
Details for the file azaks_conn-0.2.1-py3-none-any.whl.
File metadata
- Download URL: azaks_conn-0.2.1-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5583dd8e46b7cda32a2abb3bbf7853bb04429faed7989ae51e65acc7b33960cd
|
|
| MD5 |
7aa5acc5921721aefaeee385952b0f71
|
|
| BLAKE2b-256 |
447017da2c325ea34dd185773ab26fa9d4d551fa8739940369d6eaeb34c39913
|
Provenance
The following attestation bundles were made for azaks_conn-0.2.1-py3-none-any.whl:
Publisher:
release.yml on NaeemH/azaks-conn
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
azaks_conn-0.2.1-py3-none-any.whl -
Subject digest:
5583dd8e46b7cda32a2abb3bbf7853bb04429faed7989ae51e65acc7b33960cd - Sigstore transparency entry: 1930130055
- Sigstore integration time:
-
Permalink:
NaeemH/azaks-conn@7fad1d39cf286a343c5fc210ab1d6c02b6ece592 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/NaeemH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7fad1d39cf286a343c5fc210ab1d6c02b6ece592 -
Trigger Event:
push
-
Statement type: