Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

docs: add principals flag to dynamic secrets and agent docs (#6517)

Saif Ur Rahmanc75ed5657c2b
diff --git a/docs/cli/commands/dynamic-secrets.mdx b/docs/cli/commands/dynamic-secrets.mdx
index 76ea96cf59..9d136af961 100644
--- a/docs/cli/commands/dynamic-secrets.mdx
+++ b/docs/cli/commands/dynamic-secrets.mdx
@@ -184,6 +184,18 @@ The following flags are specific to certain providers or integrations:
</Accordion>
</Accordion>
+<Accordion title="SSH">
+ <Accordion title="--principals">
+ Comma-separated list of principals for the SSH certificate. Only used for SSH dynamic secrets. The requested principals must be in the allowed list configured on the dynamic secret.
+
+ ```bash
+ # Example
+ infisical dynamic-secrets lease create <dynamic-secret-name> --principals=root,deploy
+ ```
+
+ </Accordion>
+</Accordion>
+
</Accordion>
<Accordion title="infisical dynamic-secrets lease list">
This command is used to list leases for a dynamic secret.
diff --git a/docs/documentation/platform/dynamic-secrets/ssh.mdx b/docs/documentation/platform/dynamic-secrets/ssh.mdx
index afe43cf6a7..0fba5bf3f5 100644
--- a/docs/documentation/platform/dynamic-secrets/ssh.mdx
+++ b/docs/documentation/platform/dynamic-secrets/ssh.mdx
@@ -134,6 +134,21 @@ When you create an SSH dynamic secret, Infisical generates an internal CA key pa
</Step>
</Steps>
+## Generate via CLI
+
+You can also create SSH dynamic secret leases using the CLI:
+
+```bash
+infisical dynamic-secrets lease create <secret-name> \
+ --projectId=<project-id> \
+ --env=dev \
+ --principals=root,deploy
+```
+
+The `--principals` flag is required for SSH dynamic secrets and accepts a comma-separated list. The requested principals must be a subset of the allowed principals configured on the dynamic secret.
+
+For more details, see the [CLI dynamic secrets documentation](/cli/commands/dynamic-secrets).
+
## Audit or Revoke Leases
Once you have created one or more leases, you will be able to access them by clicking on the respective dynamic secret item on the dashboard.
diff --git a/docs/integrations/platforms/infisical-agent.mdx b/docs/integrations/platforms/infisical-agent.mdx
index 0133fc8bfd..aaf28f9ffb 100644
--- a/docs/integrations/platforms/infisical-agent.mdx
+++ b/docs/integrations/platforms/infisical-agent.mdx
@@ -143,7 +143,7 @@ The secret template functions is what you will use to fetch resources such as st
<Accordion title="dynamicSecret">
```bash
- dynamicSecret "<project-slug>" "<environment-slug>" "<secret-path>" "<dynamic-secret-name>" "<lease-ttl>"
+ dynamicSecret "<project-slug>" "<environment-slug>" "<secret-path>" "<dynamic-secret-name>" "<lease-ttl>" "<optional-principals>"
```
```bash example-redis-dynamic-secret
@@ -153,12 +153,22 @@ The secret template functions is what you will use to fetch resources such as st
```
+ ```bash example-ssh-dynamic-secret
+ {{ with dynamicSecret "my-project" "dev" "/" "my-ssh-secret" "1h" "root,deploy" }}
+ {{ .PRIVATE_KEY }}
+ {{ .SIGNED_KEY }}
+ {{- end }}
+
+ ```
+
**Function Name**: `dynamicSecret`
**Description**: This function can be used to render a dynamic secret lease credentials. The credentials are automatically renewed before they expire, ensuring that the rendered credentials are always up-to-date.
**Returns**: An object with keys corresponding to the dynamic secret lease credentials.
+ The `principals` argument is only applicable to SSH dynamic secrets, where it is **required**. It accepts a comma-separated list of principals for the SSH certificate. The requested principals must be in the allowed list configured on the dynamic secret.
+
<Tip>
Note that if you have multiple dynamic secret templates with identical configurations, only one lease will be created in Infisical for those templates, and the same lease will be written to your specified destination paths.
</Tip>