Closed sgundlach3 closed 1 year ago
@sgundlach3 This is a Powershell output issue. The data is there, but it isn't being displayed. There are a couple of ways to see the data you want:
PS> (Get-SafeguardAccessPolicy -EntitlementToGet 5 -PolicyToGet 3 -Fields Id,name,roleid,rolename,approversets.requiredapprovers,approversets.approvers.DisplayName,approversets.approvers.ID).ApproverSets.Approvers
DisplayName Id
----------- --
Dan Peterson 58
PS> (Get-SafeguardAccessPolicy -EntitlementToGet 5 -PolicyToGet 3 -Fields Id,name,roleid,rolename,approversets.requiredapprovers,approversets.approvers.DisplayName,approversets.approvers.ID) | ConvertTo-Json -Depth 5
{
"Id": 3,
"Name": "Linked RDP Connections",
"RoleId": 5,
"RoleName": "RDP Access",
"ApproverSets": [
{
"RequiredApprovers": 1,
"Approvers": [
{
"DisplayName": "Dan Peterson",
"Id": 58
}
]
}
]
}
Powershell isn't very good at displaying nested objects.
Hi. I'm trying to get the approvers from Access Request Policy and when I tried the commandlet in Powershell, I received this error:
PS C:\TPAM2SG> Get-SafeguardAccessPolicy -EntitlementToGet 336 -PolicyToGet 206 -Fields Id,name,roleid,rolename,approversets.requiredapprovers,approversets.approvers.DisplayName,approversets.approvers.ID
Id : 206 Name : GCAPROOT_CA_G2CA_REQ RoleId : 336 RoleName : GCAPROOT_CA_G2CA_REQ ApproverSets : {@{RequiredApprovers=1; Approvers=System.Object[]}}
When I use Swagger-- I get these results:
https://150.172.116.125/service/core/v4/Roles/336/Policies?fields=id%2Cname%2Croleid%2Crolename%2Capproversets.requiredapprovers%2Capproversets.approvers.DisplayName%2Capproversets.approvers.ID
[ { "Id": 206, "Name": "GCAPROOT_CA_G2CA_REQ", "RoleId": 336, "RoleName": "GCAPROOT_CA_G2CA_REQ", "ApproverSets": [ { "RequiredApprovers": 1, "Approvers": [ { "DisplayName": "GCAP-ROOT-APPROVERS", "Id": 432 } ] } ] } ]