Skip to content

Commit

Permalink
get-scheduleDetail
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanSebranek committed Jun 6, 2024
1 parent 27fb675 commit 1a42a7e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Module/AutomationAccount/AutomationAccount.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1274,3 +1274,31 @@ Function Assign-DscNodeConfig
return Invoke-RestMethod -Method Patch -Uri $baseUri -Headers $h -ContentType "application/json" -Body $body
}

Function Get-ScheduleDetail {
param (
[Parameter(Mandatory)]
[string]$Name,
[Parameter()]
[string]$AutomationAccountResourceId = $script:AutomationAccountResourceId
)

begin {
$headers = Get-AutoAccessToken -AsHashTable
$uri = "https://management.azure.com$AutomationAccountResourceId/schedules/$Name?api-version=2023-11-01"
}

process {
write-verbose "Fetching schedule details from $uri"
try {
$response = Invoke-RestMethod -Method Get `
-Uri $uri `
-Headers $headers `
-ErrorAction Stop
return $response
} catch {
write-error $_
throw
}
}
}

6 changes: 6 additions & 0 deletions Tasks/Manage-AutomationAccount/Manage-AutomationAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,12 @@ if (Check-Scope -Scope $scope -RequiredScope 'JobSchedules') {
Write-Warning "Schedule $($def.scheduleName) does not exist --> skipping job schedule"
continue
}

#get schedule detail
$scheduleDetail = Get-ScheduleDetail -Name $def.scheduleName
Write-Host "Get-ScheduleDetail: $($def.scheduleName)"
Write-Host $scheduleDetail

$params = @{}
if (-not [string]::IsNullOrEmpty($def.Settings)) {
$settingsFile = Get-FileToProcess -FileType JobSchedules -FileName $def.Settings
Expand Down
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "Manage-AutomationAccount",
"name": "Manage-AutomationAccount",
"version": "1.9.99",
"version": "1.9.100",
"publisher": "GreyCorbelSolutions",
"targets": [
{
Expand Down

0 comments on commit 1a42a7e

Please sign in to comment.