Metadata-Version: 2.5
Name: make-azure
Version: 0.4.0
Summary: A free-tier Azure VM for mkrun -- nearest region, DuckDNS name, nothing billed left behind; no az CLI.
Project-URL: Homepage, https://make.optersoft.com
Project-URL: Documentation, https://academy.optersoft.com/cloud/azure/virtual-machine
Author-email: "Optersoft, S.L." <david@optersoft.com>
License-Expression: MIT OR Apache-2.0
Keywords: azure,duckdns,free tier,mk,mkrun,virtual machine
Requires-Python: >=3.11
Requires-Dist: azure-identity>=1.19
Requires-Dist: mkrun>=0.4.3
Description-Content-Type: text/markdown

# make-azure

A **free-tier Azure virtual machine** for [mkrun](https://pypi.org/project/mkrun/): created in
the nearest region that will build it, optionally given a DuckDNS name, and deleted with
everything it made, so nothing is left billing.

Sign-in is Microsoft's `azure-identity`: a browser, MFA up front, tokens in the encrypted
system keychain. Everything else is plain Resource Manager HTTPS. There's no `az` CLI and
no `azure-mgmt-*` SDK.

**Documentation:** [Virtual machine — Optersoft Academy](https://academy.optersoft.com/cloud/azure/virtual-machine)

## From any shell

```console
$ uv tool install mkrun
$ mk --install azure                 # make-azure, beside mk
$ mk azure.login --tenant <tenant>   # once; a browser opens
$ mk azure.account                   # which subscription, and is it a free one
$ mk azure.region                    # the nearest regions, and the one azure.vm uses
$ mk azure.vm box                    # Ubuntu 24.04, SSH open
$ mk azure.vm box --duckdns mybox    # ...and mybox.duckdns.org points at it
$ mk azure.vm box --no-public-ip     # private network only; avoids the billed IPv4
$ mk azure.vms
$ mk azure.dns box mybox
$ mk azure.delete box
$ mk --dry-run azure.vm box          # the plan; no sign-in, nothing sent
```

With no task file in the directory, `mk` runs the tasks of the packages installed with
`mk --install`. Inside a project that has a `Makefile.py`, the file decides what is loaded;
use `mk --global azure.vm box` there.

## In a task file

```python
# /// script
# dependencies = ["make-azure"]
# ///
from make_azure import azure
```

## What is free

The free account (and Azure for Students) covers 750 hours a month of `Standard_B2ats_v2`
(the default), `Standard_B2pts_v2` or `Standard_B1s`, and a 64 GiB P6 disk, for its first 12
months. A Standard public IPv4 is **billed**, about $3.65 a month: `--no-public-ip` leaves it
out. A subscription without free services is refused unless `--paid-ok` is given.

## Settings

| variable | what |
|---|---|
| `DUCKDNS_TOKEN` | for `--duckdns` / `azure.dns`; a credential, so it's withheld and redacted |
| `SSH_PUBLIC_KEY` | the key itself (CI); else `~/.ssh/id_ed25519.pub` or `id_rsa.pub` |
| `AZURE_CLIENT_ID` + `AZURE_TENANT_ID` | sign in as an app, with `AZURE_FEDERATED_TOKEN` (CI OIDC), `AZURE_FEDERATED_TOKEN_FILE` or `AZURE_CLIENT_SECRET` |

They come from the environment or `~/.make/secrets.env`. The sign-in is remembered in
`~/.make/azure/login.json`; that file holds no secret.

## Licence

MIT OR Apache-2.0.
