Skip to content

Commit de6b81d

Browse files
authored
create dedicated auth token pages for azure and snowflake (#571)
1 parent 58ae781 commit de6b81d

9 files changed

Lines changed: 470 additions & 6 deletions

File tree

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
---
2+
title: Auth Token
3+
description: Configure your Auth Token to access and activate LocalStack for Azure.
4+
template: doc
5+
sidebar:
6+
order: 1
7+
---
8+
9+
import { Code, Tabs, TabItem } from '@astrojs/starlight/components';
10+
11+
## Introduction
12+
13+
An Auth Token is required to activate the LocalStack for Azure emulator.
14+
It identifies and authenticates users outside the LocalStack Web Application, granting access to your workspace and to advanced features such as the Azure emulator image.
15+
16+
Auth Tokens are issued at the workspace level in [app.localstack.cloud](https://app.localstack.cloud) and are not specific to any single LocalStack product.
17+
The same token works across every LocalStack product your account has access to, including LocalStack for AWS, Azure, and Snowflake.
18+
19+
Auth Tokens come in two types: a **Developer Auth Token** and a **CI Auth Token**:
20+
21+
- The **Developer Auth Token** uniquely identifies a user within a workspace.
22+
Every user has their own Auth Token.
23+
It cannot be deleted but can be rotated for security reasons if needed.
24+
- The **CI Auth Token** uniquely identifies a subscription rather than a specific user.
25+
It is designed for use in CI environments and other non-developer contexts, and is stored in the workspace where it can be managed by members with appropriate permissions.
26+
27+
In both cases, the Auth Token grants access to whatever product(s) the associated user or subscription is entitled to.
28+
Both the **Developer Auth Token** and **CI Auth Token** can be managed on the [Auth Tokens page](https://app.localstack.cloud/workspace/auth-tokens).
29+
30+
:::danger
31+
32+
- It's crucial to keep your Auth Token confidential.
33+
Do not include it in source code management systems, such as Git repositories.
34+
- Be aware that if an Auth Token is committed to a public repository, it is at risk of exposure and could remain in the repository's history, even if attempts are made to rewrite it.
35+
- In case your Auth Token is accidentally published, immediately rotate it on the [Auth Token page](https://app.localstack.cloud/workspace/auth-tokens).
36+
:::
37+
38+
## Managing your License
39+
40+
LocalStack for Azure is currently in private preview.
41+
To access it, you need a LocalStack account with **any active subscription**. This can be a paid subscription, a trial, or the Hobby subscription (terms apply).
42+
43+
:::note
44+
During the private preview, Azure access is enabled manually and cannot be self-served:
45+
46+
- If you already have a LocalStack subscription (any type), [contact support](https://localstack.cloud/contact/) to have Azure access added.
47+
- If you don't have a LocalStack subscription yet, sign up for a [Hobby subscription](https://app.localstack.cloud/sign-up) and then [contact support](https://localstack.cloud/contact/) to have Azure access added.
48+
49+
Once Azure access is enabled on your subscription, you can use the emulator with your Developer Auth Token or CI Auth Token, just like any other LocalStack product.
50+
:::
51+
52+
After your subscription has Azure access, assign the license to a user by following these steps:
53+
54+
- Visit the [Users & Licenses page](https://app.localstack.cloud/workspace/members).
55+
- Select a user in the **Workspace Members** section for license assignment.
56+
- Define the user's role via the **Member Role** dropdown.
57+
Single users automatically receive the **Admin** role.
58+
- Toggle **Advanced Permissions** to set specific permissions.
59+
Single users automatically receive full permissions.
60+
- Click **Save** to complete the assignment.
61+
Single users assign licenses to themselves.
62+
63+
If you have joined a workspace, you need to be assigned a license by the workspace administrator.
64+
When switching workspaces or licenses, make sure you are assigned to the correct license.
65+
66+
:::note
67+
If you do not assign a license, the Azure emulator will not start even if you have a valid Auth Token.
68+
:::
69+
70+
To view your own assigned license, visit the [My License page](https://app.localstack.cloud/workspace/my-license).
71+
For more details on inviting users, assigning licenses, or managing roles, see [Users and Licenses](/aws/capabilities/web-app/managing-users-licenses/).
72+
73+
## Configuring your Auth Token
74+
75+
The Azure emulator reads the Auth Token from the `LOCALSTACK_AUTH_TOKEN` environment variable.
76+
You can configure the Auth Token in several ways, depending on your setup.
77+
The following sections describe the various methods of providing your Auth Token to the Azure container.
78+
79+
:::danger
80+
81+
- It's crucial to keep your Auth Token confidential.
82+
Do not include it in source code management systems, such as Git repositories.
83+
- Be aware that if an Auth Token is committed to a public repository, it is at risk of exposure and could remain in the repository's history, even if attempts are made to rewrite it.
84+
- In case your Auth Token is accidentally published, immediately rotate it on the [Auth Token page](https://app.localstack.cloud/workspace/auth-tokens).
85+
:::
86+
87+
### LocalStack CLI
88+
89+
You should set the `LOCALSTACK_AUTH_TOKEN` environment variable either before or during the startup of LocalStack using the `localstack` command-line interface (CLI).
90+
When starting the Azure emulator, point the CLI at the Azure image via `IMAGE_NAME`:
91+
92+
<Tabs>
93+
<TabItem label="macOS/Linux">
94+
<Code
95+
code={`localstack auth set-token <YOUR_AUTH_TOKEN>\nIMAGE_NAME=localstack/localstack-azure-alpha localstack start`}
96+
lang="shell"
97+
/>
98+
</TabItem>
99+
<TabItem label="Windows">
100+
<Code
101+
code={`localstack auth set-token <YOUR_AUTH_TOKEN>\n$env:IMAGE_NAME="localstack/localstack-azure-alpha"; localstack start`}
102+
lang="powershell"
103+
/>
104+
</TabItem>
105+
</Tabs>
106+
107+
:::note
108+
109+
1. You can alternatively `export LOCALSTACK_AUTH_TOKEN=<YOUR_AUTH_TOKEN>` in your shell session.
110+
The CLI transmits the token to the Azure container, enabling license activation.
111+
2. The `localstack auth set-token` command is only available for the `localstack` CLI and cannot be used with a Docker or Docker Compose setup.
112+
:::
113+
114+
You have the option to run the Azure container in the background by appending the `-d` flag to the `localstack start` command.
115+
116+
### Docker
117+
118+
To start the Azure emulator via Docker, provide the Auth Token using the `-e` flag:
119+
120+
```bash {5}
121+
docker run \
122+
--rm -it \
123+
-p 4566:4566 \
124+
-v /var/run/docker.sock:/var/run/docker.sock \
125+
-e LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:- } \
126+
localstack/localstack-azure-alpha
127+
```
128+
129+
For more information about starting the Azure emulator with Docker, take a look at our [Azure installation guide](/azure/getting-started/#docker-cli).
130+
131+
### Docker Compose
132+
133+
To start the Azure emulator using `docker compose`, include the `LOCALSTACK_AUTH_TOKEN` environment variable in your `docker-compose.yml` file:
134+
135+
```yaml
136+
environment:
137+
- LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN:?}
138+
```
139+
140+
You can manually set the Auth Token, or use the `export` command to establish the Auth Token in your current shell session.
141+
This ensures the Auth Token is transmitted to the Azure container, enabling license activation.
142+
143+
### CI Environments
144+
145+
CI environments require a CI Auth Token.
146+
Developer Auth Tokens cannot be used in CI.
147+
CI Auth Tokens are available on the [Auth Tokens page](https://app.localstack.cloud/workspace/auth-tokens) and are configured similarly to Developer Auth Tokens.
148+
149+
To set the CI Auth Token, add the Auth Token value in the `LOCALSTACK_AUTH_TOKEN` environment variable of your CI provider, and reference it when starting the Azure emulator in your CI workflow.
150+
The same patterns used for [LocalStack in CI](/aws/integrations/continuous-integration/) apply to Azure — swap the image for `localstack/localstack-azure-alpha`.
151+
152+
## Rotating the Auth Token
153+
154+
Your personal Auth Token provides full access to your workspace and LocalStack license.
155+
Treat it as confidential and avoid sharing or storing it in source control management systems (SCMs) like Git.
156+
157+
If you believe your Auth Token has been compromised or becomes known to someone else, reset it without delay.
158+
When you reset a token, the old one is immediately deactivated and can no longer access your license or workspace.
159+
Previous tokens cannot be restored.
160+
161+
To rotate your Auth Token, go to the [Auth Token page](https://app.localstack.cloud/workspace/auth-tokens) and select the **Reset Auth Token** option.
162+
163+
## Verifying activation
164+
165+
The simplest way to verify that the Azure emulator activated successfully is to query the health endpoint:
166+
167+
<Tabs>
168+
<TabItem label="macOS/Linux">
169+
170+
```bash
171+
curl http://localhost:4566/_localstack/info | jq
172+
```
173+
174+
</TabItem>
175+
<TabItem label="Windows">
176+
177+
```bash
178+
Invoke-WebRequest -Uri http://localhost:4566/_localstack/info | ConvertFrom-Json
179+
```
180+
181+
</TabItem>
182+
</Tabs>
183+
184+
A successful activation returns `"is_license_activated": true`.
185+
You can also check the container logs for a message indicating successful license activation:
186+
187+
```bash
188+
[...] Successfully activated license
189+
```
190+
191+
Otherwise, check the [Troubleshooting](#troubleshooting) section below.
192+
193+
## Troubleshooting
194+
195+
The Azure emulator requires a successful license activation to start.
196+
If activation fails, the container exits and prints an error message similar to:
197+
198+
```bash
199+
===============================================
200+
License activation failed!
201+
202+
Reason: The credentials defined in your environment are invalid. Please make sure to set the LOCALSTACK_AUTH_TOKEN variable to a valid auth token. You can find your Auth Token in the LocalStack web app https://app.localstack.cloud.
203+
204+
Due to this error, LocalStack has quit. The Azure emulator can only be used with a valid license.
205+
```
206+
207+
The most common causes are listed below.
208+
209+
### Missing credentials
210+
211+
You need to provide an Auth Token to start the Azure emulator.
212+
You can find your Auth Token on the [Auth Tokens page](https://app.localstack.cloud/workspace/auth-tokens) in the LocalStack Web Application.
213+
214+
If you are using the `localstack` CLI, you can set the `LOCALSTACK_AUTH_TOKEN` environment variable to your Auth Token or use the following command to set it up:
215+
216+
```bash
217+
localstack auth set-token <YOUR_AUTH_TOKEN>
218+
```
219+
220+
### Invalid license
221+
222+
The issue may occur if there is no valid license linked to your account (for example, because it has expired), or if the license has not been assigned to your user.
223+
You can check your license status in the LocalStack Web Application on the [My License page](https://app.localstack.cloud/workspace/my-license).
224+
If your license does not grant access to the Azure emulator, [contact us](https://localstack.cloud/contact/) to upgrade.
225+
226+
### License server unreachable
227+
228+
LocalStack initiates offline activation when the license server is unreachable, requiring re-activation every 24 hours.
229+
Log output may indicate issues with your machine resolving the LocalStack API domain, which can be verified using a tool like `dig`:
230+
231+
```bash
232+
dig api.localstack.cloud
233+
```
234+
235+
If the result shows a status other than `status: NOERROR`, your machine is unable to resolve this domain.
236+
Certain corporate DNS servers may filter requests to specific domains.
237+
Kindly reach out to your network administrator to safelist the `localstack.cloud` domain.
238+
239+
If you continue to have problems with license activation, or if the steps above do not help, do not hesitate to [contact us](https://localstack.cloud/contact/).

src/content/docs/azure/getting-started/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sidebar:
1111

1212
You can set up the Azure emulator by utilizing LocalStack for Azure Docker image.
1313
Before starting, ensure you have a valid `LOCALSTACK_AUTH_TOKEN` to access the Azure emulator.
14-
Refer to the [Auth Token guide](/aws/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable.
14+
Refer to the [Auth Token guide](/azure/getting-started/auth-token/) to obtain your Auth Token and specify it in the `LOCALSTACK_AUTH_TOKEN` environment variable.
1515

1616
The Azure Docker image is available on the [LocalStack Docker Hub](https://hub.docker.com/r/localstack/localstack-azure).
1717
To pull the Azure Docker image, execute the following command:

src/content/docs/azure/getting-started/quickstart.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Quickstart
33
description: Get started with LocalStack for Azure in a few simple steps.
44
template: doc
55
sidebar:
6-
order: 1
6+
order: 2
77
---
88

99
## Introduction
@@ -16,6 +16,7 @@ In this guide, you will run some basic Azure CLI commands to manage resource gro
1616
- [`localstack` CLI](/aws/getting-started/installation/#localstack-cli)
1717
- [`azlocal` CLI](https://pypi.org/project/azlocal/)
1818
- [LocalStack for Azure](/azure/getting-started/)
19+
- A [LocalStack Auth Token](/azure/getting-started/auth-token/)
1920

2021
## Instructions
2122

0 commit comments

Comments
 (0)