你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Communication Services - Regenerate Key

重新生成密钥
重新生成 CommunicationService 访问密钥。 无法同时重新生成 PrimaryKey 和 SecondaryKey。

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey?api-version=2025-09-01

URI 参数

名称 必需 类型 说明
communicationServiceName
path True

string

minLength: 1
maxLength: 63
pattern: ^[-\w]+$

CommunicationService 资源的名称。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

资源组的名称。 此名称不区分大小写。

subscriptionId
path True

string (uuid)

目标订阅的 ID。 该值必须是 UUID。

api-version
query True

string

minLength: 1

要用于此操作的 API 版本。

请求正文

名称 类型 说明
keyType

KeyType

要重新生成的 keyType。 必须是“primary”或“secondary”(不区分大小写)。

响应

名称 类型 说明
200 OK

CommunicationServiceKeys

重新生成密钥请求已成功完成。 响应包含了新的密钥。

Other Status Codes

ErrorResponse

描述作失败的原因的错误响应。

示例

Regenerate key

示例请求

POST https://management.azure.com/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/communicationServices/MyCommunicationResource/regenerateKey?api-version=2025-09-01

{
  "keyType": "Primary"
}

示例响应

{
  "primaryKey": "1234",
  "primaryConnectionString": "endpoint=http://example.com;accesskey=1234"
}

定义

名称 说明
CommunicationServiceKeys

一个代表通信服务访问密钥的类。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

KeyType

要重新生成的 keyType。 必须是“primary”或“secondary”(不区分大小写)。

RegenerateKeyParameters

参数描述重新生成访问密钥的请求

CommunicationServiceKeys

一个代表通信服务访问密钥的类。

名称 类型 说明
primaryConnectionString

string

通过 primaryKey 构建的 CommunicationService 连接字符串

primaryKey

string

主访问密钥。

secondaryConnectionString

string

通过次要密钥构建的CommunicationService连接字符串

secondaryKey

string

辅助访问密钥。

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

附加信息。

type

string

附加信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

KeyType

要重新生成的 keyType。 必须是“primary”或“secondary”(不区分大小写)。

说明
Primary
Secondary

RegenerateKeyParameters

参数描述重新生成访问密钥的请求

名称 类型 说明
keyType

KeyType

要重新生成的 keyType。 必须是“primary”或“secondary”(不区分大小写)。