Skip to content

Commit

Permalink
fix fltering
Browse files Browse the repository at this point in the history
  • Loading branch information
kayasax committed Nov 7, 2024
1 parent 10205b7 commit dbbbc59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion EasyPIM/functions/Get-PIMEntraRolePendingApproval.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Get-PIMEntraRolePendingApproval{

Write-Verbose "Get-PIMAzureResourcePendingApproval start with parameters: tenantID => $tenantID"

$endpoint="/roleManagement/directory/roleAssignmentScheduleRequests/filterByCurrentUser(on='approver')?$filter=status eq 'PendingApproval'"
$endpoint="/roleManagement/directory/roleAssignmentScheduleRequests/filterByCurrentUser(on='approver')?`$filter=status eq 'PendingApproval'"
$response = Invoke-Graph -Endpoint $endpoint -Method "GET"

$out = @()
Expand Down
14 changes: 9 additions & 5 deletions EasyPIM/internal/functions/Invoke-ARM.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,19 @@ function Invoke-ARM {
write-verbose "`n>> request body: $body"
write-verbose "requested URI : $restURI ; method : $method"

$script:subscriptionID=[regex]::Matches($restURI,".*\/subscriptions\/(.*)\/providers.*$").groups[1].Value
#TODO need better way to handle mangement group scope!!
if($restURI -notmatch "managementgroups"){
$script:subscriptionID=[regex]::Matches($restURI,".*\/subscriptions\/(.*)\/providers.*$").groups[1].Value


if ( $null -eq (get-azcontext) -or ( (get-azcontext).Tenant.Id -ne $script:tenantID ) ) {
Write-Verbose ">> Connecting to Azure with tenantID $script:tenantID"
Connect-AzAccount -Tenantid $script:tenantID -Subscription $script:subscriptionID
if ( $null -eq (get-azcontext) -or ( (get-azcontext).Tenant.Id -ne $script:tenantID ) ) {
Write-Verbose ">> Connecting to Azure with tenantID $script:tenantID"
Connect-AzAccount -Tenantid $script:tenantID -Subscription $script:subscriptionID
}
}


#todo replace with invoke-azrestmethod
#replaced with invoke-azrestmethod
<#
# Get access Token
Write-Verbose ">> Getting access token"
Expand Down

0 comments on commit dbbbc59

Please sign in to comment.