创建RAM用户在指定云服务的服务凭证。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ram:CreateServiceCredential |
create |
*User
|
|
无 |
请求语法
POST HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| UserPrincipalName |
string |
否 |
RAM 用户的登录名称。 如果为空,默认为当前用户创建服务凭证。 |
test@example.onaliyun.com |
| ServiceName |
string |
是 |
阿里云服务名称 |
xxx.aliyuncs.com |
| ServiceCredentialName |
string |
是 |
服务凭证名称。 长度为 1~128 个字符,可包含英文字母、数字、半角句号(.)、短划线(-)和下划线(_)。 |
yourServiceCredentialName |
| CredentialAgeDays |
integer |
否 |
服务凭证过期时间,以天为单位。 取值范围 1-36600. 不传表示永久有效。 |
30 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID |
81313F5E-3C85-478F-BCC9-E1B70E4556DB |
| ServiceCredential |
object |
服务凭证信息 |
|
| ServiceName |
string |
阿里云服务名称 |
xxx.aliyuncs.com |
| UserPrincipalName |
string |
RAM 用户的登录名称 |
test@example.onaliyun.com |
| ServiceCredentialName |
string |
服务凭证名称 |
yourServiceCredentialName |
| ServiceCredentialId |
string |
服务凭证 ID |
SC************* |
| CreateTime |
string |
创建时间 |
2026-01-01T10:05:24Z |
| ExpirationTime |
string |
过期时间。 永久有效的服务凭证不返回该字段。 |
2026-02-01T10:05:24Z |
| Status |
string |
服务凭证状态 |
Active |
| ServiceCredentialSecret |
string |
服务凭证密钥 |
yourServiceCredentialSecret |
示例
正常返回示例
JSON格式
{
"RequestId": "81313F5E-3C85-478F-BCC9-E1B70E4556DB",
"ServiceCredential": {
"ServiceName": "xxx.aliyuncs.com",
"UserPrincipalName": "test@example.onaliyun.com",
"ServiceCredentialName": "yourServiceCredentialName",
"ServiceCredentialId": "SC*************",
"CreateTime": "2026-01-01T10:05:24Z",
"ExpirationTime": "2026-02-01T10:05:24Z",
"Status": "Active",
"ServiceCredentialSecret": "yourServiceCredentialSecret"
}
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。