All Products
Search
Document Center

Identity as a Service:Configure credential-free M2M access to cloud resources

Last Updated:Sep 25, 2026

Design credential-free machine access across cloud, container, and on-premises environments by combining native workload identities, IDaaS M2M federation, PAM authorization, and short-lived STS credentials.

1 Overview

1.1 Why we need credential-free access

Traditionally, workloads running in servers, containers, or CI/CD pipelines require a long-term AccessKey (AK/SK) stored in configuration files or environment variables to access cloud resources. This approach introduces three major challenges:

Challenge

Description

Expanded Blast Radius

Access keys proliferate across images, scripts, configuration centers, and logs. A single compromise can lead to full account takeover.

High Rotation Overhead

Manual, periodic credential rotation requires coordinating all downstream consumers, resulting in low actual compliance rates.

Poor Auditability

Multiple applications sharing a single Access Key makes it impossible to attribute API calls to specific workloads, breaking accountability.

The Credential-Free approach resolves this by ensuring workloads no longer store any long-term secrets. Instead, they leverage native identity proofs provided by the deployment environment (e.g., Instance Identity Documents, ServiceAccount tokens, X.509 certificates) to authenticate with IDaaS. IDaaS then exchanges this identity for a short-lived cloud provider STS Token. Throughout this lifecycle, zero static credentials are ever saved to disk.

1.2 End-to-End architecture flow

The architecture involves three primary entities: Client applications running in various environments (Alibaba Cloud ECS/ECI, AWS EC2, Kubernetes, On-Premises IDC, etc.; see Chapter 3) on the left; the IDaaS EIAM Authorization Server and PAM Service in the middle; and the target Cloud Provider (Alibaba Cloud, AWS, GCP, Azure, etc.) on the right. The complete flow consists of four steps:

Step

Interaction

Description

① Obtain OAuth2 AccessToken

Client App → IDaaS Auth Server

The client app authenticates via the client_credentials grant using its environment's native identity proof (see Chapters 2 & 3 for methods) to obtain a JWT AccessToken.

② Request Cloud Role STS Token

Client App → IDaaS PAM Service

The client app invokes the PAM Service's ObtainCloudAccountRoleAccessCredential endpoint (see Chapter 4) using the AccessToken, specifying the target cloud role.

③ Fetch Temporary OIDC Token

IDaaS PAM Service → IDaaS Auth Server

The PAM Service requests a short-lived OIDC Token from the Authorization Server, with the target cloud provider set as the audience.

④ Exchange for STS Token

IDaaS PAM Service → Target Cloud Provider

The PAM Service assumes the cloud role by exchanging the OIDC Token at the cloud provider's identity federation endpoint, returning the STS Token to the client app.

The client application ultimately uses the STS Token (a three-part temporary credential: AccessKeyId + AccessKeySecret + SecurityToken) to invoke the target cloud's OpenAPI/SDK, refreshing it at Step ② before expiration.

This architecture ensures no static credentials exist on either side. The client stores no long-term keys (Step ①), and the IDaaS PAM does not store target cloud Access Keys. Instead, PAM uses OIDC identity federation to assume roles (Steps ③ & ④). The cloud provider only needs an established OIDC Identity Provider trust with IDaaS and appropriate role authorizations (see Chapter 4 Prerequisites).

2 M2M application authentication methods overview

2.1 M2M application model

IDaaS EIAM's Machine-to-Machine (M2M) capabilities are built around two application types:

Role

Description

Key configurations

M2M Client App (Client)

The initiator of the authentication (your workload).

Credential management (client_id, secrets/public keys/federated credentials), network restrictions.

M2M Server App (Resource Server)

The requested service defining token audience and permissions.

Audience (aud), Scopes, Authorized client list.

The scope parameter in an AccessToken request is formatted as <Audience>|<Scope> (e.g., urn:cloud:idaas:pam|cloud_account_role:obtain_access_credential). The Server App must grant this scope to the Client App in advance.

Prerequisites: The instance must have M2M management enabled (License control), the application must have M2M client capabilities activated, and token endpoints/credentials must be provisioned.

2.2 Authentication methods

The token endpoint supports the following client authentication methods for the client_credentials grant type:

Standard credentials

Method

Mechanism

Credential format

client_secret_basic

HTTP Basic auth header using client_id + client_secret.

Shared static secret.

client_secret_post

Form parameter containing the client_secret.

Shared static secret.

client_secret_jwt

HMAC-signed JWT assertion using the client_secret (RFC 7523); the secret itself is not transmitted.

Shared static secret (derived signature).

private_key_jwt

Asymmetrically signed JWT assertion using the client's private key; IDaaS verifies using an uploaded public key.

Private key file (Default: RSA-2048; public key uploaded in PEM format).

Note

While client_secret_jwt prevents plaintext transmission, the HMAC key remains a shared static secret—if compromised, assertions can be forged. private_key_jwt is significantly more secure as the private key is never transmitted, and it can be independently rotated.

Federated credentials (core to credential-free access)

Federated credentials utilize external identity proofs submitted in the Token request via client_assertion_type and client_assertion, replacing proprietary static credentials:

Method

client_assertion_type

Assertion content

Trust anchor

PKCS#7

urn:cloud:idaas:params:oauth:client-assertion-type:pkcs7-bearer

Instance Identity Document signed by the cloud provider's metadata service (PKCS#7/CMS signature).

Cloud provider Root CA (Currently supports Alibaba Cloud and AWS).

OIDC

urn:cloud:idaas:params:oauth:client-assertion-type:id-token-bearer

ID Token issued by an external OIDC Identity Provider.

Configured Issuer + JWKS.

PCA

urn:cloud:idaas:params:oauth:client-assertion-type:x509-jwt-bearer

X.509 Client Certificate (client_x509 + client_x509_chain) + JWT signed by the certificate's private key.

Self-managed Private CA Root Certificate.

All three federated methods support two-tier expressions for granular access control (configured by administrators on the federated trust source and the application credential):

  • Trust Conditions (trustCondition): Assertion-based evaluation (e.g., restricting by Instance ID, Region, Namespace, or Certificate Subject).

  • Verification Conditions (verificationCondition): Application-level secondary validation to narrow access when multiple applications share a trust source.

Runtime credentials (PLUGIN)

Method

Mechanism

Applicable scenario

PLUGIN (OpenAPI Auth)

Reuses Alibaba Cloud runtime identities (STS credentials native to Function Compute roles, ECS roles, etc.) to invoke IDaaS OpenAPI and exchange for an M2M token. SDK config: authnMethod=PLUGIN + pluginName=alibabacloudPluginCredentialProvider.

Managed runtimes (e.g., Function Compute) where federated credentials cannot be mounted.

Note

Note: The cloud_idp assertion type is specifically for Wuying (EDS) terminal sessions and is out of scope for this document.

2.3 Verification mechanisms for federated credentials

Dimension

PKCS#7

OIDC

PCA

Assertion Source

Cloud Metadata Service (Instance-level).

Any OIDC IdP (Cluster, Platform, Enterprise IdP).

Client's Private Key.

Signature Validation

PKCS#7 signature validated against Cloud Provider Root CA.

JWT validated against Issuer + JWKS.

X.509 chain validated against uploaded Private CA Root (supports CRL revocation), then JWT validated against cert public key.

Public Key Mgmt

None required (Trust anchors are built-in).

Three sources: Static JWKS / Auto-discover via Issuer / Specify JWKS URI.

Upload Root CA (Intermediate certs provided by client in request).

Replay Protection

Signature time window validation (must not be in the future, must be within validity window).

ID Token exp/iat validation.

JWT exp/iat + Certificate Revocation List (CRL).

Client Storage Req.

Nothing (Environment provides it natively).

Nothing (Platform provisions it natively).

Certificate Private Key (Mitigated via CRL if compromised).

Typical Environment

Alibaba Cloud ECS, AWS EC2.

ACK/EKS/GKE/TKE/CCE, GCP GCE.

On-Premises IDC, high-compliance networks.

2.4 Authentication methods comparison matrix

Method

Static creds?

Leak prevention

Forgery Prevention

Rotation Overhead

Best For

client_secret_basic / post

✅

Low (Plaintext on wire)

Low (Shared secret)

Manual, high coordination

Dev/Test, PoC

client_secret_jwt

✅

Medium

Low (Forgery possible if leaked)

Manual

Legacy integrations

private_key_jwt

Private Key file

High (Key never transmitted)

High

Medium (Independent rotation)

On-Prem, CI/CD, environments lacking native identity

PKCS#7 Federation

❌

Highest

Highest (Cloud Provider backed)

Zero

Alibaba Cloud ECS, AWS EC2

OIDC Federation

❌

Highest

Highest (Platform provisioned)

Zero

Container platforms, GCP GCE

PCA Federation

Private Key (Revocable)

High

High (CA Chain + CRL)

Medium (PKI Mgmt)

On-Prem, High-compliance

PLUGIN

❌ (Reuses runtime role)

High

High

Zero

Function Compute (FC)

3 Deployment environments & authentication selection

This section outlines typical workload architectures (VMs, Containers, Serverless) across cloud providers and recommends the optimal authentication method for each. The scope covers Alibaba Cloud, AWS, GCP, Azure, Tencent Cloud, Huawei Cloud, Volcengine, as well as On-Premises IDCs, self-managed Kubernetes, and CI/CD pipelines. The final section addresses dynamic workloads in Auto Scaling scenarios.

3.1 Quick reference matrix

Section 2 explains the available authentication methods. The following matrix groups deployment environments by cloud provider and recommends a method for each. See Sections 3.2 through 3.9 for implementation details and Section 4 for the shared process that obtains Alibaba Cloud STS credentials.

Alibaba Cloud (See 3.2)

Environment

Native Identity Proof

Recommended Method

ECS (VM)

Instance Identity Document (PKCS#7)

PKCS#7 Federation

ACK (Container)

ServiceAccount OIDC Token (RRSA)

OIDC Federation

Function Compute

Runtime Execution Role

PLUGIN (OpenAPI Auth)

AWS (See 3.3)

Environment

Native Identity Proof

Recommended Method

EC2 (VM)

Instance Identity Document (PKCS#7)

PKCS#7 Federation

EKS (Container)

ServiceAccount OIDC Token (IRSA)

OIDC Federation

GCP (See 3.4)

Environment

Native Identity Proof

Recommended Method

GCE (VM)

Default Service Account OIDC Token

OIDC Federation

GKE (Container)

Workload Identity Token

OIDC Federation

Azure (See 3.5)

Environment

Native Identity Proof

Recommended Method

VM

Managed Identity Token (Entra ID)

OIDC Federation

AKS (Container)

Workload Identity Token

OIDC Federation

Tencent Cloud (See 3.6)

Environment

Native Identity Proof

Recommended Method

CVM (VM)

No public verifiable identity

private_key_jwt / PCA

TKE (Container)

ServiceAccount OIDC Token

OIDC Federation

Huawei Cloud (See 3.7)

Environment

Native Identity Proof

Recommended Method

ECS (VM)

No public verifiable identity

private_key_jwt / PCA

CCE (Container)

ServiceAccount OIDC Token

OIDC Federation

Volcengine (See 3.8)

Environment

Native Identity Proof

Recommended Method

ECS (VM)

No public verifiable identity

private_key_jwt / PCA

VKE (Container)

ServiceAccount OIDC Token (IRSA)

OIDC Federation

On-premises & CI/CD (See 3.9)

Environment

Native identity proof

Recommended method

Self-managed K8s

ServiceAccount OIDC Token

OIDC Federation

Bare Metal / IDC

None (Requires PKI)

PCA / private_key_jwt

Local Dev

None

private_key_jwt

CI/CD Pipelines

Platform OIDC (e.g., GitHub Actions)

OIDC Federation / private_key_jwt

Golden rule: Always prioritize native identities (PKCS#7 / OIDC / PLUGIN) for zero static credentials. If native verifiable identities are unavailable, use private_key_jwt or PCA, where private keys are never transmitted and can be revoked. Use client_secret methods only for development or initial validation.

3.2 Alibaba Cloud workloads

Alibaba Cloud provides end-to-end credential-free best practices across all major compute types. Other clouds will follow similar integration patterns.

3.2.1 ECS (VM) — PKCS#7 Federation

ECS instances can fetch an Instance Identity Document and a PKCS#7 signature from the Instance Metadata Service (IMDS). This signature is backed by Alibaba Cloud's Root CA, requiring zero keys on the instance. When fetching the signature, bind the target IDaaS instance ID to the audience to prevent replay attacks. In IDaaS, create a PKCS#7 Trust Source ("Alibaba Cloud"), and use the signature as the client_assertion (pkcs7-bearer) to exchange for an AccessToken.

Signatures are short-lived. Fetch and use them immediately; do not cache them. Use Trust Conditions to restrict access to specific regions. For end-to-end instructions, see Best practice: obtain STS credentials on ECS without static credentials.

3.2.2 ACK (Container) — OIDC Federation (RRSA)

ACK's RRSA (RAM Roles for Service Accounts) allows Pods to obtain platform-issued OIDC Tokens. Once the ack-pod-identity-webhook is installed, the token path is injected into the ALIBABA_CLOUD_OIDC_TOKEN_FILE environment variable. Create an OIDC Trust Source in IDaaS using the ACK cluster's Issuer URL and use the token as the client_assertion (id-token-bearer). Trust conditions can lock down access to specific Namespaces and ServiceAccounts.

For end-to-end instructions, see Best practice: obtain STS credentials on ACK without static credentials. The same pattern applies to self-managed Kubernetes clusters, as described in Section 3.9.1.

3.2.3 Function Compute (FC) — PLUGIN (OpenAPI Auth)

Managed runtimes cannot easily mount federated credentials but possess native execution roles. The PLUGIN method reuses this STS role to invoke the IDaaS OpenAPI and fetch an M2M token. The function's RAM role must have permissions to call IDaaS APIs.

For SDK details, see IDaaS EIAM SDK documentation and Prepare the SDK environment.

3.3 AWS workloads

AWS commonly runs workloads on EC2 virtual machines and EKS containers. For serverless environments such as Lambda, use private_key_jwt and inject the KMS- or Secrets Manager-protected private key at runtime because no platform identity proof is available for third-party validation.

3.3.1 EC2 — PKCS#7 Federation

AWS EC2 provides Identity Documents via IMDSv2. In IDaaS, select AWS as the Trust Source for PKCS#7 Federation. The integration is identical to Alibaba Cloud ECS (3.2.1). Ensure Trust Conditions are used to restrict access by AWS Account ID or Region. (Verify IDaaS release status for AWS PKCS#7 before deploying).

3.3.2 EKS — OIDC Federation

EKS clusters natively expose OIDC Issuers and JWKS endpoints via IRSA. Follow the ACK integration pattern (3.2.2), configuring the EKS Issuer in IDaaS and submitting the Pod's ServiceAccount token as the client_assertion.

3.4 GCP workloads

GCP issues OIDC tokens through its service-account model for virtual machines, containers, and Cloud Run. Use OIDC federation for these workloads.

3.4.1 GCE (VM) — OIDC Federation

GCE instances can fetch OIDC identity tokens for their default service account from the metadata server. Configure an IDaaS OIDC Trust Source using Google's identity service as the Issuer and use the instance token as the assertion.

3.4.2 GKE (Container) — OIDC Federation

GKE leverages Workload Identity to provision OIDC tokens. Integrate using the standard OIDC Federation pattern (3.2.2), ensuring IDaaS can resolve the GKE cluster's Issuer and JWKS endpoints.

3.5 Azure workloads

Azure VMs and AKS provide identities issued by Microsoft Entra ID. Both integrate through OIDC federation. Managed services such as Azure Functions also support managed identities.

3.5.1 VM — OIDC Federation (Managed Identity)

Azure VMs use Managed Identities to fetch JWTs signed by Microsoft Entra ID. Configure the OIDC Trust Source in IDaaS with the Entra ID tenant Issuer and JWKS.

3.5.2 AKS (Container) — OIDC Federation (Workload Identity)

AKS supports Workload Identity. Follow the standard OIDC Federation pattern (3.2.2) using the AKS cluster's Issuer URL.

3.6 Tencent Cloud workloads

Tencent Cloud commonly runs workloads on CVM virtual machines and TKE containers. For serverless environments such as SCF, use private_key_jwt.

3.6.1 CVM (VM) — private_key_jwt / PCA Federation

Tencent CVMs do not expose publicly verifiable instance identity documents and therefore cannot use PKCS#7 federation. Recommended options:

  • private_key_jwt: Distribute the private key through encrypted configuration management and upload the public key to IDaaS. The private key is never sent in requests.

  • PCA federation: Prefer this option if enterprise PKI is available. A compromised certificate can be revoked through a CRL.

3.6.2 TKE (Container) — OIDC Federation

If the TKE cluster exposes an OIDC Issuer and JWKS, integrate using the standard OIDC Federation pattern in Section 3.2.2. IDaaS also supports Tencent Cloud identity management for managing target-cloud credentials.

3.7 Huawei Cloud workloads

Huawei Cloud commonly runs workloads on ECS virtual machines and CCE containers.

3.7.1 ECS (VM) — private_key_jwt / PCA Federation

Similar to Tencent CVM, Huawei ECS lacks verifiable instance signatures. Use private_key_jwt or PCA Federation.

3.7.2 CCE (Container) — OIDC Federation

Integrate using the standard OIDC Federation pattern (3.2.2) if the CCE cluster exposes ServiceAccount issuers.

3.8 Volcengine workloads

Volcengine commonly runs workloads on cloud servers and VKE containers.

3.8.1 ECS (VM) — private_key_jwt / PCA Federation

Volcengine ECS lacks verifiable instance signatures. Use private_key_jwt or PCA Federation.

3.8.2 VKE (Container) — OIDC Federation (IRSA)

VKE supports IRSA, issues ServiceAccount OIDC tokens, and exposes OIDC issuer and JWKS endpoints. Integrate using the standard OIDC Federation pattern in Section 3.2.2, and restrict access by namespace and ServiceAccount.

3.9 On-premises & CI/CD

On-premises environments do not have a cloud-provider identity and must establish their own trust root. Self-managed Kubernetes is the exception because it can issue ServiceAccount OIDC tokens.

3.9.1 Self-managed Kubernetes — OIDC Federation

Standard Kubernetes can issue bound ServiceAccount tokens that contain the issuer, audience, expiration, namespace, and ServiceAccount claims. Integrate as follows:

  1. Cluster: Configure kube-apiserver ServiceAccount token issuance, including --service-account-issuer and --service-account-signing-key-file, and publish /.well-known/openid-configuration and /openid/v1/jwks at an address that IDaaS can reach.

  2. IDaaS: Create an OIDC federated trust source with the cluster issuer and either uploaded JWKS or a JWKS URI.

  3. Application: Read the projected ServiceAccount token and submit it as the client_assertion using id-token-bearer.

  4. Trust conditions: Restrict access by namespace and ServiceAccount to isolate workloads.

3.9.2 Bare metal / IDC — PCA or private_key_jwt

Without cloud-native identities, you must establish a trust anchor. PCA Federation is ideal for enterprises with existing PKI, providing robust revocation (CRL). private_key_jwt is suitable for rapid adoption without PKI.

3.9.3 Local development

Use private_key_jwt. Inject the private key securely via local environment variables. Never hardcode secrets in source code.

3.9.4 CI/CD pipelines

If the platform supports OIDC (e.g., GitHub Actions), use OIDC Federation. Otherwise, use private_key_jwt, injecting the private key via the platform's secret manager.

3.10 Auto Scaling scenarios (ECS + Auto Scaling)

Traditional static Access Keys are highly problematic for Auto Scaling Groups (ASG), as credentials must be baked into images, expanding the blast radius as instances scale out, while obfuscating audit trails.

Federated credentials natively solve this by shifting trust from the instance to the environment:

Dimension

Static AK model

Federated model (PKCS#7 / OIDC)

Credential Provisioning

Distributed via images/scripts.

Automatically fetched from IMDS upon boot. Zero credential distribution.

Trust Mechanism

Shared Secrets.

Validated via Cloud Root CA / JWKS + Trust Conditions.

Auditability

Shared AK makes attribution impossible.

Assertions contain Instance IDs / Pod names, ensuring granular auditability.

Implementation

Requires complex secret pipelines.

Zero code changes.

Integration best practices for auto scaling:

  1. Never bind Trust Conditions to instance IDs: Because Auto Scaling dynamically provisions new IDs, hardcoding them will cause authentications to fail. Instead, bind Trust Conditions to the Image ID (AMI) to establish a stable, workload-specific trust perimeter.

  2. Alternative (PLUGIN): Assign an instance RAM role to the Launch Template. New instances natively assume the role, and the PLUGIN method invokes IDaaS seamlessly.

  3. Fetch signatures in real-time: Do not cache IMDS signatures. Fetch a fresh PKCS#7 signature immediately prior to token exchange.

  4. Clean images: Ensure Launch Templates and custom images contain absolutely no credentials.

  5. Granular auditing: IDaaS logs capture the unique Instance ID from the assertion, allowing you to differentiate API calls made by newly scaled instances versus existing ones.

The image-ID and PLUGIN patterns also apply to other cloud scaling services. For AWS EC2 Auto Scaling, bind PKCS#7 trust conditions to the AMI ID. GCP managed instance groups and Azure virtual machine scale sets automatically expose managed identity tokens for OIDC. Container autoscaling through HPA or Cluster Autoscaler retains ServiceAccount-based isolation without distributing credentials.

Note

For non-federated environments such as Tencent Cloud, Huawei Cloud, and Volcengine VMs, Auto Scaling requires secure private-key injection through encrypted images, configuration management such as Vault, or secure startup retrieval, plus tested revocation and rotation procedures. If practical, move these workloads to a container platform and use OIDC federation to eliminate key distribution.

4 Obtaining Alibaba Cloud STS tokens (cloud account management)

Note

This section describes the standard Alibaba Cloud flow: AccessToken → IDaaS DeveloperAPI → Alibaba Cloud STS credentials. Every deployment pattern in Section 3 uses this flow after obtaining an AccessToken. The same API and parameters also return temporary credentials for managed AWS and Tencent Cloud roles through awsStsToken and tencentCloudStsToken.

4.1 Prerequisites

Prerequisite

Description

Machine Identity Management is enabled

The IDaaS instance has Machine Identity Management enabled.

Cloud account is managed

Add the Alibaba Cloud account under Asset Management > Cloud Identity, and create or synchronize the RAM role.

PAM feature authorization

Authorize the application to use the built-in PAM permission Obtain Cloud Account Role Access Credential.

Scope authorization

Grant cloud_account_role:obtain_access_credential under audience urn:cloud:idaas:pam to the client application, and request scope=urn:cloud:idaas:pam|cloud_account_role:obtain_access_credential.

4.2 Invoke ObtainCloudAccountRoleAccessCredential

curl -s --request GET \
  --url "https://eiam-developerapi.<region>.aliyuncs.com/v2/<instanceId>/cloudAccountRoles/_/actions/obtainAccessCredential?cloudAccountRoleExternalId=acs:ram::<Account_ID>:role/<Role_Name>&durationSeconds=3600" \
  --header "Authorization: Bearer <AccessToken>"

Parameter

Required

Description

instanceId

Yes

IDaaS Instance ID.

Authorization

Yes

Bearer <AccessToken> obtained via M2M authentication.

cloudAccountRoleExternalId

Yes

The ARN of the target cloud role (e.g., acs:ram::13xxxxxx76:role/role-test).

durationSeconds

No

STS Token TTL in seconds (900-43200, subject to cloud provider limits).

Use GET /v2/{instanceId}/cloudAccountRoles/_/actions/listAssumableCloudAccountRoles with NextToken cursor pagination to discover cloud roles that the current identity can assume.

4.3 Response structure

{
  "cloudAccountId": "ca_01kmegjc11qa1txxxxx",
  "cloudAccountRoleId": "carole_01kmek49aqxxxx",
  "cloudAccountRoleName": "role-test",
  "cloudAccountRoleExternalId": "acs:ram::xxx:role/role-test",
  "cloudAccountVendorType": "alibaba_cloud",
  "cloudAccountRoleAccessCredential": {
    "accessCredentialExpiresAt": 1767196800,
    "alibabaCloudStsToken": {
      "accessKeyId": "STS.NUgYrLnoC37mZZCNnAbez****",
      "accessKeySecret": "****",
      "securityToken": "****",
      "expiration": "2026-10-20T04:27:09Z"
    }
  }
}

Field

Description

cloudAccountRoleAccessCredential.alibabaCloudStsToken

The three-part Alibaba Cloud STS credential: accessKeyId, accessKeySecret, and securityToken. Supply all three when calling Alibaba Cloud OpenAPI.

accessCredentialExpiresAt

Credential expiration as a Unix timestamp in seconds. Refresh before this time.

cloudAccountVendorType

Cloud account type. This example uses alibaba_cloud; the API can also return credential structures for AWS and Tencent Cloud.

4.4 Credential usage and rotation

  • Proactive Refresh: Refresh the STS token slightly before expiration (e.g., 5 minutes prior) rather than fetching a new token for every API call.

  • SDK Injection: Pass the three-part credential to the Alibaba Cloud SDK's CredentialsProvider. The SDK will automatically append the SecurityToken.

  • Short TTLs: Keep durationSeconds as brief as the workload requires (default 3600s recommended).

4.5 SDK integration (recommended)

IDaaS provides dedicated SDKs to automate the entire lifecycle (Auth → AccessToken → STS Token → Refresh):

SDK

Artifact

Responsibility

Core SDK

idaas-java-core-sdk

M2M Auth, Token fetching, and refreshing.

Alibabacloud Adapter

idaas-java-akless-alibabacloud-adapter

Credential-Free Adapter: Assumes managed cloud roles and provisions temporary STS credentials.

With the Core SDK deployment configuration, set clientDeployEnvironment=ALIBABA_CLOUD_ECS for PKCS#7 or KUBERNETES for OIDC. The SDK selects the appropriate federated credential material without requiring environment-specific business logic.

5 Security best practices

Best practice

Description

Scope Least Privilege

Grant only explicitly required scopes. Avoid wildcards (.all). Isolate different workloads into distinct M2M applications.

Granular Trust Conditions

Enforce trustCondition / verificationCondition on federated credentials to lock down access by Instance ID, Region, Namespace, or Certificate Subject, mitigating lateral movement.

Network Fencing

Configure network perimeter restrictions (CIDR blocks/IPs) on the M2M application to ensure tokens can only be requested from authorized VPCs.

Short-Lived Credentials

Minimize TTLs for both AccessTokens and STS Tokens. Fetch PKCS#7 signatures dynamically and never persist them.

Audience Binding

Always bind the aud claim in instance identities to your IDaaS Instance ID to prevent cross-instance replay attacks.

Incident Response Plans

For private_key_jwt/PCA architectures, test your revocation pipelines (deleting IDaaS public keys / publishing CRLs) to ensure rapid damage control capabilities.

Comprehensive Auditing

Monitor IDaaS audit logs. Federated authentications log the exact credential ID (including JWT jti / Certificate Serial Number) and key claims, ensuring robust traceability.

Appendix A: Documentation and SDK index

Topic

Link

Credential-free ECS access (end-to-end PKCS#7)

Best practice: obtain STS credentials on ECS without static credentials

Credential-free ACK access (end-to-end RRSA and OIDC)

Best practice: obtain STS credentials on ACK without static credentials

Credential-free M2M access to cloud resources

Configure credential-free M2M access to cloud resources

M2M applications

M2M applications

Temporary cloud-role credentials API

ObtainCloudAccountRoleAccessCredential

Cloud identity management

Cloud identity management

AWS cloud identity management

AWS cloud identity management

Tencent Cloud identity management

Tencent Cloud identity management

IDaaS EIAM SDK

IDaaS EIAM SDK documentation

SDK authentication configuration

Prepare the SDK environment

Volcengine VKE IRSA

Volcengine VKE IRSA overview

Azure managed identities

Azure managed identities overview

Appendix B: FAQ

Q1: Where can I find the token endpoint? Open the M2M application details and choose General Configuration > Application Configuration Information > Token Endpoint. The instance endpoint uses https://<instance-id>.aliyunidaas.com/api/v2/{authorizationServerId}/oauth2/token. The default authorization server is iauths_system.

Q2: How do I resolve "scope required" or "unauthorized" errors? A client_credentials request must include scope in the <audience>|<permission> format. Also verify that the M2M server application grants the permission to the client application.

Q3: Why does PKCS#7 authentication report signature-time validation failure? The signature time is outside the validity window or is in the future. Request a fresh signature and submit it immediately instead of caching it. Also check the instance clock for drift.

Q4: How do I configure JWKS for an OIDC federated credential? Use one of three sources: upload static JWKS, discover JWKS from the Issuer, or specify a JWKS URI. Cluster platforms typically use Issuer discovery or a JWKS URI.

Q5: What does PCA authentication require? Submit client_x509 (one client certificate), client_x509_chain (the intermediate certificate chain), and client_assertion (a JWT signed by the certificate private key whose audience includes the client ID and token endpoint). Upload the private CA root certificate to IDaaS as the trust anchor.

Q6: Can I obtain STS credentials for target clouds such as AWS and Tencent Cloud? ObtainCloudAccountRoleAccessCredential supports credential structures for Alibaba Cloud, AWS, Tencent Cloud, Huawei Cloud, GCP, and Microsoft Entra ID. This topic focuses on Alibaba Cloud. Follow IDaaS cloud identity management updates for additional multicloud guidance.

Q7: Why does Function Compute use PLUGIN instead of a federated credential? Managed serverless runtimes cannot access instance metadata or mount certificate material, but they provide runtime role credentials. PLUGIN reuses those credentials for OpenAPI authentication and still eliminates static credentials.