@microsoft/rayfin-guide 1.34.0-beta.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/docs/cli/index.md
CHANGED
|
@@ -52,6 +52,7 @@ For the full walkthrough, see the [CLI Quickstart](./quickstart.md) or the [Buil
|
|
|
52
52
|
| `npx rayfin up` | Deploy the project to Microsoft Fabric. If you are not signed in, the CLI launches an interactive login flow. Use `-t, --tenant <id>` when your account spans multiple tenants, `-w, --workspace <name>` for a Fabric workspace display name, `-n, --dry-run` to preview without API calls, and `-v, --verbose` for detailed output. Pass `--encryption-fallback-enabled` only when login fails with a keychain error to allow plaintext token storage on systems without OS credential storage, such as some Linux distros, dev containers, and Codespaces. Use `--exclude-services staticHosting` to skip static content build/package/deploy while leaving runtime settings untouched — useful during local development when Vite serves the frontend. Applies runtime settings, database configuration, and static content when enabled. |
|
|
53
53
|
| `npx rayfin up status` | Display the status of the Fabric deployment (add `--json` for machine-readable output). |
|
|
54
54
|
| `npx rayfin up db apply` | Generate and apply DAB configuration to the remote Rayfin item. Add `--force` to allow changes that may cause data loss. |
|
|
55
|
+
| `npx rayfin up secrets apply` | Read secrets from `rayfin/.env` file (prefixed with `RAYFIN_SECRET_`) and securely apply them to the remote Rayfin item workload. Validates that secrets are persisted. Use `--env-file <path>` to specify a custom .env file location. |
|
|
55
56
|
| `npx rayfin up staticapp deploy` | Build, package, and deploy static content to the remote Rayfin item. Add `--skip-build` to deploy existing build output without rebuilding. |
|
|
56
57
|
|
|
57
58
|
## Update the CLI
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 50
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Managing Secrets
|
|
6
|
+
|
|
7
|
+
The Rayfin CLI provides secure secret management for your remote deployments.
|
|
8
|
+
Secrets are encrypted and stored securely in your Rayfin item workload.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Use the `rayfin up secrets apply` command to manage application secrets for your remote deployment.
|
|
13
|
+
Secrets are read from your `.env` file, securely transmitted to your workload, encrypted, and validated.
|
|
14
|
+
|
|
15
|
+
## Setting up secrets
|
|
16
|
+
|
|
17
|
+
### 1. Define secrets in `.env`
|
|
18
|
+
|
|
19
|
+
Create a `rayfin/.env` file with secrets prefixed using `RAYFIN_SECRET_`:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# rayfin/.env
|
|
23
|
+
RAYFIN_SECRET_API_KEY=sk-prod-abc123xyz789
|
|
24
|
+
RAYFIN_SECRET_DATABASE_PASSWORD=secure-db-pass-123
|
|
25
|
+
RAYFIN_SECRET_AUTH_TOKEN=token-abcdefg-hijklmn
|
|
26
|
+
RAYFIN_SECRET_OPENAI_KEY=sk-openai-your-key-here
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> **Secret naming:** Secret names must follow the `RAYFIN_SECRET_` prefix convention.
|
|
30
|
+
> The part after the prefix becomes your secret name.
|
|
31
|
+
> For example, `RAYFIN_SECRET_API_KEY` creates a secret named `API_KEY`.
|
|
32
|
+
|
|
33
|
+
### 2. Deploy your item
|
|
34
|
+
|
|
35
|
+
Before managing secrets, deploy your project to Microsoft Fabric:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx rayfin up
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This creates your Rayfin item and sets up the workload endpoint.
|
|
42
|
+
|
|
43
|
+
### 3. Apply secrets
|
|
44
|
+
|
|
45
|
+
Apply your secrets to the remote workload:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx rayfin up secrets apply
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The CLI will:
|
|
52
|
+
1. Read your `rayfin/.env` file
|
|
53
|
+
2. Extract all `RAYFIN_SECRET_*` variables
|
|
54
|
+
3. Securely send each secret to your workload
|
|
55
|
+
4. Encrypt and persist the secrets
|
|
56
|
+
5. Validate that all secrets were successfully saved
|
|
57
|
+
|
|
58
|
+
### 4. Verify secrets
|
|
59
|
+
|
|
60
|
+
After running the apply command, you'll see output confirming each secret:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
🔐 Acquiring authentication token...
|
|
64
|
+
✓ Token acquired
|
|
65
|
+
📤 Sending 4 secret(s) to workload...
|
|
66
|
+
✓ Secrets sent to workload (4 persisted)
|
|
67
|
+
✅ Validating secrets persisted to workload...
|
|
68
|
+
✓ All secrets validated
|
|
69
|
+
|
|
70
|
+
✨ Secrets applied successfully (4/4)
|
|
71
|
+
✓ API_KEY
|
|
72
|
+
✓ DATABASE_PASSWORD
|
|
73
|
+
✓ AUTH_TOKEN
|
|
74
|
+
✓ OPENAI_KEY
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Advanced usage
|
|
78
|
+
|
|
79
|
+
### Custom .env file location
|
|
80
|
+
|
|
81
|
+
If your secrets are in a non-standard location, use the `--env-file` option:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx rayfin up secrets apply --env-file ./config/secrets.env
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### JSON output
|
|
88
|
+
|
|
89
|
+
For automation or scripting, use `--json` for machine-readable output:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx rayfin up secrets apply --json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Output example:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"status": "success",
|
|
100
|
+
"message": "All secrets applied and validated",
|
|
101
|
+
"secretsCount": 4,
|
|
102
|
+
"persisted": 4,
|
|
103
|
+
"validated": true,
|
|
104
|
+
"secrets": [
|
|
105
|
+
{
|
|
106
|
+
"name": "API_KEY",
|
|
107
|
+
"id": "secret-123",
|
|
108
|
+
"createdAt": "2026-04-17T10:30:00Z"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Verbose logging
|
|
115
|
+
|
|
116
|
+
Enable detailed logging for debugging:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx rayfin up secrets apply --verbose
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Non-interactive mode
|
|
123
|
+
|
|
124
|
+
Use `-y` or `--yes` to skip confirmation prompts:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
npx rayfin up secrets apply -y
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Secret handling and security
|
|
131
|
+
|
|
132
|
+
### Encryption
|
|
133
|
+
|
|
134
|
+
Secrets are transmitted over HTTPS with encrypted payloads.
|
|
135
|
+
The workload endpoint encrypts and persists secrets securely.
|
|
136
|
+
Secrets are never logged or displayed after being sent to the workload.
|
|
137
|
+
|
|
138
|
+
### Best practices
|
|
139
|
+
|
|
140
|
+
1. **Use `.env` files for local development only** – Never commit `.env` files to version control.
|
|
141
|
+
Add `.env` to your `.gitignore`:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
echo "rayfin/.env" >> .gitignore
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
2. **Use environment variables for CI/CD** – In automated environments, set `RAYFIN_SECRET_*` variables directly:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
export RAYFIN_SECRET_API_KEY=prod-key-from-vault
|
|
151
|
+
npx rayfin up secrets apply
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
3. **Rotate secrets regularly** – Re-run `rayfin up secrets apply` after updating secret values in your `.env` file.
|
|
155
|
+
|
|
156
|
+
4. **Separate development and production secrets** – Use different `.env` files or environment variables for each environment.
|
|
157
|
+
|
|
158
|
+
## Troubleshooting
|
|
159
|
+
|
|
160
|
+
### No secrets found
|
|
161
|
+
|
|
162
|
+
If you see "No secrets found in .env file", verify:
|
|
163
|
+
|
|
164
|
+
- Your `.env` file exists at `rayfin/.env`
|
|
165
|
+
- Variables are prefixed with `RAYFIN_SECRET_`
|
|
166
|
+
- The file is readable by the CLI process
|
|
167
|
+
|
|
168
|
+
### Authentication failed
|
|
169
|
+
|
|
170
|
+
If you see "Failed to acquire authentication token":
|
|
171
|
+
|
|
172
|
+
- Run `npx rayfin login` to sign in
|
|
173
|
+
- Check that you have valid Entra ID credentials
|
|
174
|
+
- On containers or restricted environments, use `--encryption-fallback-enabled` or set `RAYFIN_ENCRYPTION_FALLBACK_ENABLED=true`
|
|
175
|
+
|
|
176
|
+
### Validation inconclusive
|
|
177
|
+
|
|
178
|
+
If some secrets fail validation:
|
|
179
|
+
|
|
180
|
+
- Check your network connection to Fabric
|
|
181
|
+
- Verify the workload endpoint is running and healthy
|
|
182
|
+
- Run `npx rayfin up status` to confirm deployment health
|
|
183
|
+
- Re-run `npx rayfin up secrets apply` to retry
|
|
184
|
+
|
|
185
|
+
### Permission denied
|
|
186
|
+
|
|
187
|
+
If you see permission errors:
|
|
188
|
+
|
|
189
|
+
- Ensure you're authenticated with an account that has access to the Fabric workspace
|
|
190
|
+
- Verify you have the correct workspace selected
|
|
191
|
+
- Run `npx rayfin login --select` to choose a different account/tenant
|
|
192
|
+
|
|
193
|
+
## See also
|
|
194
|
+
|
|
195
|
+
- [CLI quickstart](./quickstart.md)
|
|
196
|
+
- [Environment configuration](./env-interpolation.md)
|
|
@@ -197,24 +197,13 @@ The regeneration step updates tables, relationships, and permissions so subseque
|
|
|
197
197
|
Rayfin uses class-level role decorators to generate Data API Builder (DAB) permissions.
|
|
198
198
|
Use `@role()` directly, or the `@anonymous()` and `@authenticated()` shorthands.
|
|
199
199
|
|
|
200
|
-
> **Anonymous data access is not currently supported on Fabric.**
|
|
201
|
-
> Both `@anonymous(...)` and `@role('anonymous', …)` are accepted at compile time, but `rayfin dev` and `rayfin up`, along with any sub-command that involves creating, updating, or applying data schema, reject any DAB configuration that grants the `anonymous` role. Remove the `@anonymous(...)` decorator (or `@role('anonymous', …)`) from your entities; all access then goes through the `authenticated` role.
|
|
202
|
-
>
|
|
203
|
-
> The `@anonymous()` shorthand is published from the experimental subpath as a preview of the future supported syntax:
|
|
204
|
-
>
|
|
205
|
-
> ```typescript
|
|
206
|
-
> import { anonymous } from '@microsoft/rayfin-core/experimental';
|
|
207
|
-
> ```
|
|
208
|
-
>
|
|
209
|
-
> The `@role('anonymous', …)` form is also importable from `@microsoft/rayfin-core/experimental` and behaves identically.
|
|
210
|
-
|
|
211
200
|
### Public read, authenticated write
|
|
212
201
|
|
|
213
|
-
|
|
202
|
+
Grant unauthenticated callers read access with `@anonymous('read')` while
|
|
203
|
+
keeping writes restricted to the owning authenticated user.
|
|
214
204
|
|
|
215
205
|
```typescript
|
|
216
|
-
import { entity, authenticated, uuid, text } from '@microsoft/rayfin-core';
|
|
217
|
-
import { anonymous } from '@microsoft/rayfin-core/experimental';
|
|
206
|
+
import { entity, anonymous, authenticated, uuid, text } from '@microsoft/rayfin-core';
|
|
218
207
|
|
|
219
208
|
@entity()
|
|
220
209
|
@anonymous('read')
|
|
@@ -253,6 +242,7 @@ export class Document {
|
|
|
253
242
|
- `@role()` applies to classes.
|
|
254
243
|
Field visibility is configured through role options.
|
|
255
244
|
- Only the built-in roles are supported today: `anonymous` and `authenticated`.
|
|
245
|
+
- To use anonymous data with Microsoft Fabric, please reach out to your tenant admin to enable the tenant admin switch "Enable anonymous data access for Fabric Apps"
|
|
256
246
|
|
|
257
247
|
## Best practices
|
|
258
248
|
|
|
@@ -27,10 +27,10 @@ Visit and ensure you can view the Timestamp Tracker.
|
|
|
27
27
|
Add a `message` field to the **Timestamp** entity in `rayfin/data/Timestamp.ts`.
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
|
-
import { entity,
|
|
30
|
+
import { entity, anonymous, uuid, text, date } from '@microsoft/rayfin-core';
|
|
31
31
|
|
|
32
32
|
@entity()
|
|
33
|
-
@
|
|
33
|
+
@anonymous()
|
|
34
34
|
export class Timestamp {
|
|
35
35
|
@uuid() id!: string;
|
|
36
36
|
@date() timestamp!: Date;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rayfin-guide",
|
|
3
|
-
"version": "1.34.0
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "Cross-cutting Builder guides for the Rayfin platform — discovered by `@microsoft/rayfin-docs` via the `rayfinDocs` package.json field convention.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|