Passwordless Console Login for End Users
Under Platform Edition, environments are created by the platform inside a single Tencent Cloud account, and end users usually have no Tencent Cloud account. When users need to troubleshoot, read logs, or adjust resources themselves, you can issue a passwordless login URL. When the user clicks to open the console, the platform backend looks up that user's accessible environments in its own database, generates a session policy from that list, assumes the role for a temporary credential, and redirects with a signature so the browser enters the console directly.
Users never touch a long-term key, and the scope they can operate is decided by the session policy passed for each issuance.
Relationship to API Keys
The two credential types solve different problems and can coexist:
| Method | Where it is used | Permission scope |
|---|---|---|
| API Key | Cloud API calls from Agent tools, MCP, and CLI | A single environment, with a platform built-in security baseline that blocks environment deletion |
| Passwordless login (this document) | Browser access to the CloudBase console | Defined by the session policy; can span multiple environments and be limited to specific actions |
Architecture
| Object | Owner | Purpose |
|---|---|---|
| User-to-environment mapping | Platform database | The list of environments the user can access; sets the scope of the session policy |
| Role | Tencent Cloud account | Account-level permission carrier. One role serves all tenants; no per-environment role is needed |
| Session policy | Platform backend | Passed on every AssumeRole call to narrow the role permissions down to specified environments |
| Temporary credential | Returned by STS | Lifetime set by DurationSeconds, used to sign the login URL |
| Passwordless login URL | Issued by the platform backend | Can be reopened within its lifetime; unusable after expiry |
Prerequisites
| Item | How to obtain |
|---|---|
| Account UIN | Access Management → Account Information |
| Environment ID | CloudBase console → Environment overview, formatted as prod-8gxxxxxx |
| AppID | Same place as the environment ID; used to build storage bucket names |
| User-to-environment mapping | Maintained in the platform database; looked up per user at issuance time |
Step 1: Create a Role
Access Management → Roles → Create role → Tencent Cloud account (do not choose "Service role").
| Setting | Value |
|---|---|
| Role name | TCBResourceAllAccess |
| Role carrier | Tencent Cloud account → current master account |
| Attached policy | QcloudAccessForTCBRole (CloudBase preset policy with full CloudBase permissions) |
| Console login | Enabled |
The trust policy allows only the current master account to assume the role:
{
"version": "2.0",
"statement": [
{
"action": "name/sts:AssumeRole",
"effect": "allow",
"principal": { "qcs": ["qcs::cam::uin/{UIN}:root"] }
}
]
}
Once a sub-account or another account is added, it can assume the role on its own and pass any session policy it likes, which breaks environment isolation.
The role is an account-level permission carrier. Each tenant's scope is decided by the session policy passed on every AssumeRole call, so there is no need to create roles or policies per environment.
Enabling console login is equivalent to calling cam:UpdateRoleConsoleLogin with ConsoleLogin = 1. You can also toggle it on the role details page.
Step 2: Narrow the Scope with a Session Policy
The session policy is the Policy parameter of AssumeRole, a CAM policy document string. It narrows what this credential can touch within the role permissions, so the role only needs one full CloudBase preset policy and every tenant boundary is drawn here.
The environment list in the policy comes from the user-to-environment mapping in the platform database, looked up per user at issuance, not from CAM: the role carries the full preset policy, and CAM has no notion of tenant boundaries.
Reuse the per-environment policy from Grant permissions with custom policies, under "Configure a policy isolated by environment": replace the environment placeholders with that user's environment IDs and pass the document to Policy as a single-line string. That policy already covers the tcb, tcbr, scf, cos, cls, and lowcode resources the console needs, so this document does not keep another copy.
Authorize multiple environments
Append environment IDs to the resource array of the resource-level statements:
{
"effect": "allow",
"action": ["tcb:*"],
"resource": [
"qcs::tcb::uin/{UIN}:env/{ENV_ID_A}",
"qcs::tcb::uin/{UIN}:env/{ENV_ID_B}"
]
}
The same applies to scf:*, cos:*, and lowcode:*. Adding an environment only means appending its ID to the mapping and the policy; no CAM configuration changes are involved.
Caveats
Two things trip people up in the passwordless login scenario, unlike logging in with a sub-account:
- Do not put
tcb:DescribeEnvsin the account-level read-only statement. It is a resource-level API. At account level withresource: "*", the user's environment list shows every environment in the account. - Keep the
actioncount low. The session policy is expanded into the temporary credential at issuance. Exceeding the limit returnsInvalidParameter.ExtendStrategyOverSize; trim the actions in the account-level statement instead of copying the full preset role policy.
Step 3: Issue a Passwordless Login URL
The signature rules, parameter definitions, and language samples are maintained by Access Management: see Passwordless console login with a role. On the CloudBase side you only need to point s_url at the console home page, so this section covers just that part.
Call order:
- Call
sts:AssumeRolewith the role ARN and the session policy built above, and take the returnedTmpSecretId,TmpSecretKey, andToken. - Compute the signature with the temporary credential as described in the official document and assemble the login URL.
- Return the URL to the browser, with
s_urlset to the CloudBase console home page,https://tcb.cloud.tencent.com/dev.
RoleSessionName is recorded in operation logs. Put the business user identifier in it for auditing.
Validity
| Item | Notes |
|---|---|
DurationSeconds | 300 seconds recommended. It only limits exchanging the URL for a console session; once logged in the console session lives on, and URL expiry does not sign the user out |
| Reopenable | The URL can be opened more than once within its lifetime; it is not single use. After DurationSeconds it stops working and signature validation fails, so issue a new one |
| When to issue | Issue on every click. Do not cache long term or pre-generate in batches, or you end up handing out URLs that have already expired |
Permission Boundaries
The following limits are inherent to this design. Confirm they are acceptable before integration:
| Boundary | Notes |
|---|---|
| Console visibility follows the role policy | The session policy only narrows what this credential can operate. The console loads its environment list from the policies attached to the role, so the environment dropdown may list other environments in the account; entering them fails |
| Account-level data cannot be narrowed per environment | Package usage, bills, and activity notices come from account-level APIs that have no CAM resource type, so they can only be granted on *. Users see account-wide totals |
| Some services have no CAM resource definition | For example, the instance attribute APIs of CloudBase-managed PostgreSQL can only be granted on * (read-only) |
| Console sessions outlive the URL | URL expiry does not affect a session already signed in. Revoking access is handled at the role level; deleting the role removes access for every user at once |
FAQ
resource (qcs::tcb:<region>:uin/<UIN>:env/*) has no permission
The resource identifier in the session policy carries a region. Write it as qcs::tcb:: with the region segment empty, and do the same for other services.
AssumeRole returns InvalidParameter.ExtendStrategyOverSize
The session policy has too many action entries and exceeds the expansion limit at issuance. Trim the actions in the account-level statement instead of copying the full preset role policy.
The URL fails signature validation after a while
The URL is valid only within DurationSeconds and cannot be reused afterwards. Issue a new one.
The console opens but some pages are blank or report no permission
Self-check first by calling tcb:DescribeEnvs directly with the temporary credential from AssumeRole: if omitting EnvId returns only the authorized environments and passing an unauthorized environment ID returns an empty list, the session policy is working, and a blank page means the actions it needs are missing from the policy — add them as the page reports. If the first call already returns other environments in the account, the resource identifiers or the scope are wrong; recheck Step 2.
Can the URL lifetime be extended
DurationSeconds can be increased, but it weakens security and is unnecessary: the URL only exchanges for a console session, and the session is independent afterwards. Keep 300 seconds and issue on every click.