本文介绍如何使用现有的资源管理专用链接。 它描述了用于获取和删除现有资源的 API 操作。
如果需要创建资源管理专用链接,请参阅使用门户创建专用链接以管理 Azure 资源或使用 API 创建专用链接以管理 Azure 资源。
资源管理专用链接
若要获取特定的资源管理专用链接,请发送以下请求:
示例
# Login first with az login if not using Cloud Shell
az resourcemanagement private-link show --resource-group PrivateLinkTestRG --name NewRMPL
示例
# Login first with Connect-AzAccount if not using Cloud Shell
Get-AzResourceManagementPrivateLink -ResourceGroupName PrivateLinkTestRG -Name NewRMPL
REST 调用
GET https://management.azure.com/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/resourceManagementPrivateLinks/{rmplName}?api-version=2020-05-01
操作返回:
{
"properties": {
"privateEndpointConnections": []
},
"id": {rmplResourceId},
"name": {rmplName},
"type": "Microsoft.Authorization/resourceManagementPrivateLinks",
"___location": {region}
}
若要获取订阅中的所有资源管理专用链接,请使用:
# Login first with az login if not using Cloud Shell
az resourcemanagement private-link list
# Login first with Connect-AzAccount if not using Cloud Shell
Get-AzResourceManagementPrivateLink
REST 调用
GET
https://management.azure.com/subscriptions/{subscriptionID}/providers/Microsoft.Authorization/resourceManagementPrivateLinks?api-version=2020-05-01
操作返回:
[
{
"properties": {
"privateEndpointConnections": []
},
"id": {rmplResourceId},
"name": {rmplName},
"type": "Microsoft.Authorization/resourceManagementPrivateLinks",
"___location": {region}
},
{
"properties": {
"privateEndpointConnections": []
},
"id": {rmplResourceId},
"name": {rmplName},
"type": "Microsoft.Authorization/resourceManagementPrivateLinks",
"___location": {region}
}
]
若要删除特定的资源管理专用链接,请使用:
示例
# Login first with az login if not using Cloud Shell
az resourcemanagement private-link delete --resource-group PrivateLinkTestRG --name NewRMPL
示例
# Login first with Connect-AzAccount if not using Cloud Shell
Remove-AzResourceManagementPrivateLink -ResourceGroupName PrivateLinkTestRG -Name NewRMPL
REST 调用
DELETE
https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/resourceManagementPrivateLinks/{rmplName}?api-version=2020-05-01
操作返回:Status 200 OK
。
专用链接关联
若要获取管理组的特定专用链接关联,请使用:
示例
# Login first with az login if not using Cloud Shell
az private-link association show --management-group-id fc096d27-0434-4460-a3ea-110df0422a2d --name 1d7942d1-288b-48de-8d0f-2d2aa8e03ad4
示例
# Login first with Connect-AzAccount if not using Cloud Shell
Get-AzPrivateLinkAssociation -ManagementGroupId fc096d27-0434-4460-a3ea-110df0422a2d -Name 1d7942d1-288b-48de-8d0f-2d2aa8e03ad4 | fl
REST 调用
GET
https://management.azure.com/providers/Microsoft.Management/managementGroups/{managementGroupID}/providers/Microsoft.Authorization/privateLinkAssociations?api-version=2020-05-01
操作返回:
{
"value": [
{
"properties": {
"privateLink": {rmplResourceID},
"tenantId": {tenantId},
"scope": "/providers/Microsoft.Management/managementGroups/{managementGroupId}"
},
"id": {plaResourceId},
"type": "Microsoft.Authorization/privateLinkAssociations",
"name": {plaName}
}
]
}
若要删除专用链接关联,请使用:
示例
# Login first with az login if not using Cloud Shell
az private-link association delete --management-group-id 24f15700-370c-45bc-86a7-aee1b0c4eb8a --name 1d7942d1-288b-48de-8d0f-2d2aa8e03ad4
示例
# Login first with Connect-AzAccount if not using Cloud Shell
Remove-AzPrivateLinkAssociation -ManagementGroupId 24f15700-370c-45bc-86a7-aee1b0c4eb8a -Name 1d7942d1-288b-48de-8d0f-2d2aa8e03ad4
REST 调用
DELETE
https://management.azure.com/providers/Microsoft.Management/managementGroups/{managementGroupID}/providers/Microsoft.Authorization/privateLinkAssociations/{plaID}?api-version=2020-05-01
操作返回:Status 200 OK
。
后续步骤