From 1c65daa4d9d4e4506d221074962ddf83a25e9bf9 Mon Sep 17 00:00:00 2001 From: Jesper Fajers Date: Mon, 2 Dec 2024 09:45:33 +0100 Subject: [PATCH] Update --- src/internal/classes/AzOpsRoleEligibilityScheduleRequest.ps1 | 2 +- .../functions/Get-AzOpsRoleEligibilityScheduleRequest.ps1 | 5 ++++- src/localized/en-us/Strings.psd1 | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/internal/classes/AzOpsRoleEligibilityScheduleRequest.ps1 b/src/internal/classes/AzOpsRoleEligibilityScheduleRequest.ps1 index cdc30cde..ca1a1ec9 100644 --- a/src/internal/classes/AzOpsRoleEligibilityScheduleRequest.ps1 +++ b/src/internal/classes/AzOpsRoleEligibilityScheduleRequest.ps1 @@ -20,7 +20,7 @@ StartDateTime = $roleEligibilitySchedule.StartDateTime } } - $this.Id = $roleEligibilityScheduleRequest.Id + $this.Id = $roleEligibilitySchedule.RequestId $this.Name = $roleEligibilitySchedule.Name $this.ResourceType = $roleEligibilityScheduleRequest.Type } diff --git a/src/internal/functions/Get-AzOpsRoleEligibilityScheduleRequest.ps1 b/src/internal/functions/Get-AzOpsRoleEligibilityScheduleRequest.ps1 index 4e913597..51aaed7c 100644 --- a/src/internal/functions/Get-AzOpsRoleEligibilityScheduleRequest.ps1 +++ b/src/internal/functions/Get-AzOpsRoleEligibilityScheduleRequest.ps1 @@ -30,13 +30,16 @@ if ($roleEligibilitySchedules) { foreach ($roleEligibilitySchedule in $roleEligibilitySchedules) { # Process roleEligibilitySchedule together with RoleEligibilityScheduleRequest + $roleEligibilityScheduleRequest = $null $roleEligibilityScheduleRequest = Get-AzRoleEligibilityScheduleRequest -Scope $ScopeObject.Scope -Name $roleEligibilitySchedule.Name -ErrorAction SilentlyContinue if ($roleEligibilityScheduleRequest) { Write-AzOpsMessage -LogLevel Debug -LogString 'Get-AzOpsRoleEligibilityScheduleRequest.Assignment' -LogStringValues $roleEligibilitySchedule.Name -Target $ScopeObject # Construct AzOpsRoleEligibilityScheduleRequest by combining information from roleEligibilitySchedule and roleEligibilityScheduleRequest [AzOpsRoleEligibilityScheduleRequest]::new($roleEligibilitySchedule, $roleEligibilityScheduleRequest) + } else { - Write-AzOpsMessage -LogLevel Important -LogString 'Get-AzOpsRoleEligibilityScheduleRequest.Processing' -LogStringValues "No RoleEligibilityScheduleRequest found for RoleEligibilitySchedule in scope: $($ScopeObject.scope), creating template based on RoleEligibilitySchedule" -Target $ScopeObject + Write-AzOpsMessage -LogLevel Verbose -LogString 'Get-AzOpsRoleEligibilityScheduleRequest.Processing.NotFound' -LogStringValues $ScopeObject.Scope, $roleEligibilitySchedule.Name -Target $ScopeObject + # Construct AzOpsRoleEligibilityScheduleRequest from roleEligibilitySchedule since no AzRoleEligibilityScheduleRequest was found [AzOpsRoleEligibilityScheduleRequest]::new($roleEligibilitySchedule) } } diff --git a/src/localized/en-us/Strings.psd1 b/src/localized/en-us/Strings.psd1 index aa992207..cadaeb11 100644 --- a/src/localized/en-us/Strings.psd1 +++ b/src/localized/en-us/Strings.psd1 @@ -132,6 +132,7 @@ 'Get-AzOpsRoleDefinition.Definition' = 'Processing object {0}' # $roleDefinition.id 'Get-AzOpsRoleEligibilityScheduleRequest.Processing' = 'Retrieving Privileged Identity Management RoleEligibilitySchedule at [{0}]' # $ScopeObject.Scope + 'Get-AzOpsRoleEligibilityScheduleRequest.Processing.NotFound' = 'No RoleEligibilityScheduleRequest found at [{0}] for RoleEligibilitySchedule [{1}], creating template based on RoleEligibilitySchedule' # $ScopeObject.Scope, $roleEligibilitySchedule.Name 'Get-AzOpsRoleEligibilityScheduleRequest.Assignment' = 'Found Privileged Identity Management RoleEligibilityScheduleRequest assignment [{0}]' # $roleEligibilitySchedule.Name 'Get-AzOpsSubscription.Excluded.Offers' = 'Excluded subscription offers: {0}' # ($ExcludedOffers -join ',')