你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Topics - List Shared Access Keys
参考
服务:
Event Grid
API 版本:
2025-02-15
列出主题的键。
列出用于发布到主题的两个键。
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}/listKeys?api-version=2025-02-15
URI 参数
名称
在
必需
类型
说明
resourceGroupName
path
True
string
用户订阅中的资源组的名称。
subscriptionId
path
True
string
唯一标识Microsoft Azure 订阅的订阅凭据。 订阅 ID 构成了每个服务调用的 URI 的一部分。
POST https://management.azure.com/subscriptions/5b4b650e-28b9-4790-b3ab-ddbd88d727c4/resourceGroups/examplerg/providers/Microsoft.EventGrid/topics/exampletopic2/listKeys?api-version=2025-02-15
/**
* Samples for Topics ListSharedAccessKeys.
*/
public final class Main {
/*
* x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/
* Topics_ListSharedAccessKeys.json
*/
/**
* Sample code: Topics_ListSharedAccessKeys.
*
* @param manager Entry point to EventGridManager.
*/
public static void topicsListSharedAccessKeys(com.azure.resourcemanager.eventgrid.EventGridManager manager) {
manager.topics().listSharedAccessKeysWithResponse("examplerg", "exampletopic2",
com.azure.core.util.Context.NONE);
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.eventgrid import EventGridManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-eventgrid
# USAGE
python topics_list_shared_access_keys.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = EventGridManagementClient(
credential=DefaultAzureCredential(),
subscription_id="5b4b650e-28b9-4790-b3ab-ddbd88d727c4",
)
response = client.topics.list_shared_access_keys(
resource_group_name="examplerg",
topic_name="exampletopic2",
)
print(response)
# x-ms-original-file: specification/eventgrid/resource-manager/Microsoft.EventGrid/stable/2025-02-15/examples/Topics_ListSharedAccessKeys.json
if __name__ == "__main__":
main()