Skip to content

Authentication

Aspire.Hosting.Netlify resolves a Netlify auth token at deploy time and falls back to interactive ntl login if nothing is configured.

  1. Parameter — the authToken argument passed to PublishAsNetlifySite(...).
  2. Environment variableNETLIFY_AUTH_TOKEN.
  3. Interactive login — the pipeline calls ntl login once per aspire deploy run if neither of the above produced a non-empty token.

Use the aspire secret command from the directory containing your AppHost. The CLI auto-discovers the AppHost project (or pass --apphost <path> to be explicit) and persists the value in the standard user-secrets store.

Terminal window
aspire secret set Parameters:netlify-token "$(cat ~/.config/netlify/auth)"

Inspect or remove a stored value at any time:

Terminal window
aspire secret list
aspire secret get Parameters:netlify-token
aspire secret delete Parameters:netlify-token
var authToken = builder.AddParameterFromConfiguration(
"netlify-token", "NETLIFY_AUTH_TOKEN", secret: true);
builder.AddJavaScriptApp("astro", "../astro")
.PublishAsNetlifySite("dist", authToken);

In GitHub Actions, set the env var on the deploy job:

- name: Aspire deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: aspire deploy

A Netlify auth token is created at app.netlify.com/user/applications#personal-access-tokens. Do not check it in — the integration logs Site IDs and tokens with the <redacted> placeholder, but only because it never sees the literal value outside of the configured parameter / env var.