如何在 azure powershell 中查找特定的专用端点
How to find specific private endpoint in azure powershell
我运行在 azure 中使用此命令来提取与存储帐户关联的专用端点:
Get-AzPrivateEndpointConnection -privatelinkresourceid /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname
它 return 的结果如下所示:
Name : storageaccountname.93jd9v4a-84d3-942z-9g32-3895820193842
Id : /subscriptions/SubscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname/privateEndp
ointConnections/storageaccountname.93jd9v4a-84d3-942z-9g32-3895820193842
GroupId :
ProvisioningState : Succeeded
PrivateEndpoint : {
"Id": "/subscriptions/SubscriptionID/resourceGroups/rgname/providers/Microsoft.Network/privateEndpoints/PE1"
}
PrivateLinkServiceConnectionState : {
"Status": "Pending",
"Description": ""
}
LinkIdentifier :
Name : storageaccountname.840ar94v-492s-594v-942s-49204816482941a
Id : /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname/privateEndp
ointConnections/storageaccountname.840ar94v-492s-594v-942s-49204816482941a
GroupId :
ProvisioningState : Succeeded
PrivateEndpoint : {
"Id": "/subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Network/privateEndpoints/PE2"
}
PrivateLinkServiceConnectionState : {
"Status": "Approved",
"Description": "2022-05-23: approved"
}
LinkIdentifier :
我希望它 return 只是在“PrivateEndpoint”参数中有 PE2 的那个,所以我 运行:
Get-AzPrivateEndpointConnection -privatelinkresourceid /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname | where-object privateendpoint -like "*PE2*"
但它 return 什么都没有。如果我 运行...:[=14=]
Get-AzPrivateEndpointConnection -privatelinkresourceid /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname | where-object privateendpoint -like "*"
...它 return 全部。
如何使用 where-object return PE2 的 PrivateEndpoint?
我没有任何要查询的私有端点,但查看对象的结构,您似乎需要 Id
的值。
Where-Object { $_.privateendpoint.Id -like "*PE2*" }
我们也尝试了与您相同的问题并遇到了同样的问题,并尝试了以下 where object format with id
并且成功了。
Where-Object { $_.privateendpoint.Id -like "*PE1*" }
没有显示:-
成功获取详情:-
或者 我们可以在此处使用 Given REST API
通过使用我们的私有连接名称来获得相同的结果:-
具有私有端点的存储帐户详细信息:-
我运行在 azure 中使用此命令来提取与存储帐户关联的专用端点:
Get-AzPrivateEndpointConnection -privatelinkresourceid /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname
它 return 的结果如下所示:
Name : storageaccountname.93jd9v4a-84d3-942z-9g32-3895820193842
Id : /subscriptions/SubscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname/privateEndp
ointConnections/storageaccountname.93jd9v4a-84d3-942z-9g32-3895820193842
GroupId :
ProvisioningState : Succeeded
PrivateEndpoint : {
"Id": "/subscriptions/SubscriptionID/resourceGroups/rgname/providers/Microsoft.Network/privateEndpoints/PE1"
}
PrivateLinkServiceConnectionState : {
"Status": "Pending",
"Description": ""
}
LinkIdentifier :
Name : storageaccountname.840ar94v-492s-594v-942s-49204816482941a
Id : /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname/privateEndp
ointConnections/storageaccountname.840ar94v-492s-594v-942s-49204816482941a
GroupId :
ProvisioningState : Succeeded
PrivateEndpoint : {
"Id": "/subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Network/privateEndpoints/PE2"
}
PrivateLinkServiceConnectionState : {
"Status": "Approved",
"Description": "2022-05-23: approved"
}
LinkIdentifier :
我希望它 return 只是在“PrivateEndpoint”参数中有 PE2 的那个,所以我 运行:
Get-AzPrivateEndpointConnection -privatelinkresourceid /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname | where-object privateendpoint -like "*PE2*"
但它 return 什么都没有。如果我 运行...:[=14=]
Get-AzPrivateEndpointConnection -privatelinkresourceid /subscriptions/subscriptionID/resourceGroups/rgname/providers/Microsoft.Storage/storageAccounts/storageaccountname | where-object privateendpoint -like "*"
...它 return 全部。
如何使用 where-object return PE2 的 PrivateEndpoint?
我没有任何要查询的私有端点,但查看对象的结构,您似乎需要 Id
的值。
Where-Object { $_.privateendpoint.Id -like "*PE2*" }
我们也尝试了与您相同的问题并遇到了同样的问题,并尝试了以下 where object format with id
并且成功了。
Where-Object { $_.privateendpoint.Id -like "*PE1*" }
没有显示:-
成功获取详情:-
或者 我们可以在此处使用 Given REST API
通过使用我们的私有连接名称来获得相同的结果:-
具有私有端点的存储帐户详细信息:-