diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.dll new file mode 100644 index 000000000000..471b9c310fcd Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.pdb b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.pdb new file mode 100644 index 000000000000..45b729bf1951 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.pdb differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.psd1 b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.psd1 new file mode 100644 index 000000000000..242356b27906 --- /dev/null +++ b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.psd1 @@ -0,0 +1,95 @@ +@{ + # Version number of this module. + ModuleVersion = '1.0.2' + + # Supported PSEditions + CompatiblePSEditions = @('Core') + + # ID used to uniquely identify this module + GUID = '841fad61-94f5-4330-89be-613d54165289' + + # Author of this module + Author = 'Microsoft Corporation' + + # Company or vendor of this module + CompanyName = 'Microsoft Corporation' + + # Copyright statement for this module + Copyright = '(c) Microsoft Corporation. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'Initial release of the Durable Functions SDK for PowerShell. This package is to be used exclusively with the Azure Functions PowerShell worker.' + + # Minimum version of the PowerShell engine required by this module + PowerShellVersion = '7.2' + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() # TODO: use this for pretty-printing DF tasks + + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() # TODO: use this for pretty-printing DF tasks + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + NestedModules = @('./AzureFunctions.PowerShell.Durable.SDK.dll', './AzureFunctions.PowerShell.Durable.SDK.psm1') + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @( + 'Get-DurableStatus', + 'New-DurableOrchestrationCheckStatusResponse', + 'Send-DurableExternalEvent', + 'Start-DurableOrchestration' + 'Stop-DurableOrchestration' + ) + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = @( + 'Invoke-DurableActivity', + 'Invoke-DurableSubOrchestrator', + 'New-DurableRetryPolicy', + 'Set-DurableCustomStatus', + 'Set-FunctionInvocationContext', + 'Start-DurableExternalEventListener' + 'Start-DurableTimer', + 'Stop-DurableTimerTask', + 'Wait-DurableTask', + 'Get-DurableTaskResult' + ) + + # Variables to export from this module + VariablesToExport = '*' + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = @( + 'Invoke-ActivityFunction', + 'New-OrchestrationCheckStatusResponse', + 'Start-NewOrchestration', + 'Wait-ActivityFunction', + 'New-DurableRetryOptions' + ) + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @('Microsoft', 'Azure', 'Functions', 'Serverless', 'Cloud', 'Workflows', 'Durable', 'DurableTask') + + # A URL to the license for this module. + LicenseUri = 'https://github.com/Azure/azure-functions-durable-powershell/blob/main/LICENSE' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/Azure/azure-functions-durable-powershell' + + # ReleaseNotes of this module + # ReleaseNotes = '' #TODO: add release notes. + + # Prerelease string of this module + #Prerelease = 'alpha' + + } # End of PSData hashtable + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' # TODO: explore +} \ No newline at end of file diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.psm1 b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.psm1 new file mode 100644 index 000000000000..bb0df9a2697d --- /dev/null +++ b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/AzureFunctions.PowerShell.Durable.SDK.psm1 @@ -0,0 +1,308 @@ +# +# Copyright (c) Microsoft. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +using namespace System.Net + +# Set aliases for cmdlets to export +Set-Alias -Name Wait-ActivityFunction -Value Wait-DurableTask +Set-Alias -Name Invoke-ActivityFunction -Value Invoke-DurableActivity +Set-Alias -Name New-OrchestrationCheckStatusResponse -Value New-DurableOrchestrationCheckStatusResponse +Set-Alias -Name Start-NewOrchestration -Value Start-DurableOrchestration +Set-Alias -Name New-DurableRetryOptions -Value New-DurableRetryPolicy + +function GetDurableClientFromModulePrivateData { + $PrivateData = $PSCmdlet.MyInvocation.MyCommand.Module.PrivateData + if ($null -eq $PrivateData -or $null -eq $PrivateData['DurableClient']) { + throw "Could not find `DurableClient` private data. This can occur when you have not set application setting 'ExternalDurablePowerShellSDK' to 'true' or if you're using a DurableClient CmdLet but have no DurableClient binding declared in `function.json`." + } + else { + $PrivateData['DurableClient'] + } +} + +function Get-DurableStatus { + [CmdletBinding()] + param( + [Parameter( + Mandatory = $true, + Position = 0, + ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [string] $InstanceId, + + [Parameter( + ValueFromPipelineByPropertyName = $true)] + [object] $DurableClient, + + [switch] $ShowHistory, + + [switch] $ShowHistoryOutput, + + [switch] $ShowInput + ) + + $ErrorActionPreference = 'Stop' + + if ($null -eq $DurableClient) { + $DurableClient = GetDurableClientFromModulePrivateData + } + + $requestUrl = "$($DurableClient.BaseUrl)/instances/$InstanceId" + + $query = @() + if ($ShowHistory.IsPresent) { + $query += "showHistory=true" + } + if ($ShowHistoryOutput.IsPresent) { + $query += "showHistoryOutput=true" + } + if ($ShowInput.IsPresent) { + $query += "showInput=true" + } + + if ($query.Count -gt 0) { + $requestUrl += "?" + [string]::Join("&", $query) + } + + Invoke-RestMethod -Uri $requestUrl +} + +<# +.SYNOPSIS + Start an orchestration Azure Function. +.DESCRIPTION + Start an orchestration Azure Function with the given function name and input value. +.EXAMPLE + PS > Start-DurableOrchestration -DurableClient Starter -FunctionName OrchestratorFunction -InputObject "input value for the orchestration function" + Return the instance id of the new orchestration. +.PARAMETER FunctionName + The name of the orchestration Azure Function you want to start. +.PARAMETER InputObject + The input value that will be passed to the orchestration Azure Function. +.PARAMETER DurableClient + The orchestration client object. +#> +function Start-DurableOrchestration { + [CmdletBinding()] + param( + [Parameter( + Mandatory=$true, + Position=0, + ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] $FunctionName, + + [Parameter( + Position=1, + ValueFromPipelineByPropertyName=$true)] + [object] $InputObject, + + [Parameter( + ValueFromPipelineByPropertyName=$true)] + [object] $DurableClient, + + [Parameter( + ValueFromPipelineByPropertyName=$true)] + [string] $InstanceId + ) + + $ErrorActionPreference = 'Stop' + + if ($null -eq $DurableClient) { + $DurableClient = GetDurableClientFromModulePrivateData + } + + if (-not $InstanceId) { + $InstanceId = (New-Guid).Guid + } + + $Uri = + if ($DurableClient.rpcBaseUrl) { + # Fast local RPC path + "$($DurableClient.rpcBaseUrl)orchestrators/$FunctionName$($InstanceId ? "/$InstanceId" : '')" + } else { + # Legacy app frontend path + $UriTemplate = $DurableClient.creationUrls.createNewInstancePostUri + $UriTemplate.Replace('{functionName}', $FunctionName).Replace('[/{instanceId}]', "/$InstanceId") + } + + $Body = $InputObject | ConvertTo-Json -Compress -Depth 100 + + $null = Invoke-RestMethod -Uri $Uri -Method 'POST' -ContentType 'application/json' -Body $Body + + return $instanceId +} + +function Stop-DurableOrchestration { + [CmdletBinding()] + param( + [Parameter( + Mandatory = $true, + Position = 0, + ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [string] $InstanceId, + + [Parameter( + Mandatory = $true, + Position = 1, + ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [string] $Reason + ) + + $ErrorActionPreference = 'Stop' + + if ($null -eq $DurableClient) { + $DurableClient = GetDurableClientFromModulePrivateData + } + + $requestUrl = "$($DurableClient.BaseUrl)/instances/$InstanceId/terminate?reason=$([System.Web.HttpUtility]::UrlEncode($Reason))" + + Invoke-RestMethod -Uri $requestUrl -Method 'POST' +} + +function IsValidUrl([uri]$Url) { + $Url.IsAbsoluteUri -and ($Url.Scheme -in 'http', 'https') +} + +function GetUrlOrigin([uri]$Url) { + $fixedOriginUrl = New-Object System.UriBuilder + $fixedOriginUrl.Scheme = $Url.Scheme + $fixedOriginUrl.Host = $Url.Host + $fixedOriginUrl.Port = $Url.Port + $fixedOriginUrl.ToString() +} + +function New-DurableOrchestrationCheckStatusResponse { + [CmdletBinding()] + param( + [Parameter( + Mandatory=$true, + ValueFromPipelineByPropertyName=$true)] + [object] $Request, + + [Parameter( + Mandatory=$true, + ValueFromPipelineByPropertyName=$true)] + [string] $InstanceId, + + [Parameter( + ValueFromPipelineByPropertyName=$true)] + [object] $DurableClient + ) + + if ($null -eq $DurableClient) { + $DurableClient = GetDurableClientFromModulePrivateData + } + + [uri]$requestUrl = $Request.Url + $requestHasValidUrl = IsValidUrl $requestUrl + $requestUrlOrigin = GetUrlOrigin $requestUrl + + $httpManagementPayload = [ordered]@{ } + foreach ($entry in $DurableClient.managementUrls.GetEnumerator()) { + $value = $entry.Value + + if ($requestHasValidUrl -and (IsValidUrl $value)) { + $dataOrigin = GetUrlOrigin $value + $value = $value.Replace($dataOrigin, $requestUrlOrigin) + } + + $value = $value.Replace($DurableClient.managementUrls.id, $InstanceId) + $httpManagementPayload.Add($entry.Name, $value) + } + + [HttpResponseContext]@{ + StatusCode = [HttpStatusCode]::Accepted + Body = $httpManagementPayload + Headers = @{ + 'Content-Type' = 'application/json' + 'Location' = $httpManagementPayload.statusQueryGetUri + 'Retry-After' = 10 + } + } +} + +<# +.SYNOPSIS + Send an external event to an orchestration instance. +.DESCRIPTION + Send an external event with the given event name, and event data to an orchestration instance with the given instance ID. +.EXAMPLE + PS > Send-DurableExternalEvent -InstanceId "example-instance-id" -EventName "ExampleExternalEvent" -EventData "data for the external event" + Return the instance id of the new orchestration. +.PARAMETER InstanceId + The ID of the orchestration instance that will handle the external event. +.PARAMETER EventName + The name of the external event. +.PARAMETER EventData + The JSON-serializable data associated with the external event. +.PARAMETER TaskHubName + The TaskHubName of the orchestration instance that will handle the external event. +.PARAMETER ConnectionName + The name of the connection string associated with TaskHubName +#> +function Send-DurableExternalEvent { + [CmdletBinding()] + param( + [Parameter( + Mandatory=$true, + Position=0, + ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] $InstanceId, + + [Parameter( + Mandatory=$true, + Position=1, + ValueFromPipelineByPropertyName=$true)] + [string] $EventName, + + [Parameter( + Position=2, + ValueFromPipelineByPropertyName=$true)] + [object] $EventData, + + [Parameter( + ValueFromPipelineByPropertyName=$true)] + [string] $TaskHubName, + + [Parameter( + ValueFromPipelineByPropertyName=$true)] + [string] $ConnectionName + ) + + $DurableClient = GetDurableClientFromModulePrivateData + + $RequestUrl = GetRaiseEventUrl -DurableClient $DurableClient -InstanceId $InstanceId -EventName $EventName -TaskHubName $TaskHubName -ConnectionName $ConnectionName + + $Body = $EventData | ConvertTo-Json -Compress -Depth 100 + + $null = Invoke-RestMethod -Uri $RequestUrl -Method 'POST' -ContentType 'application/json' -Body $Body +} + +function GetRaiseEventUrl( + $DurableClient, + [string] $InstanceId, + [string] $EventName, + [string] $TaskHubName, + [string] $ConnectionName) { + + $RequestUrl = $DurableClient.BaseUrl + "/instances/$InstanceId/raiseEvent/$EventName" + + $query = @() + if ($null -eq $TaskHubName) { + $query += "taskHub=$TaskHubName" + } + if ($null -eq $ConnectionName) { + $query += "connection=$ConnectionName" + } + if ($query.Count -gt 0) { + $RequestUrl += "?" + [string]::Join("&", $query) + } + + return $RequestUrl +} \ No newline at end of file diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Castle.Core.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Castle.Core.dll new file mode 100644 index 000000000000..96e43f2136f9 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Castle.Core.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableEngine.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableEngine.dll new file mode 100644 index 000000000000..6d7af1ed665f Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableEngine.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableEngine.pdb b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableEngine.pdb new file mode 100644 index 000000000000..c3d8bba31098 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableEngine.pdb differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableTask.Core.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableTask.Core.dll new file mode 100644 index 000000000000..3382c7d6ddfb Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/DurableTask.Core.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Bcl.AsyncInterfaces.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Bcl.AsyncInterfaces.dll new file mode 100644 index 000000000000..fe6ba4c549bc Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Bcl.AsyncInterfaces.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Abstractions.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Abstractions.dll new file mode 100644 index 000000000000..0dc818acefc3 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Abstractions.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Client.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Client.dll new file mode 100644 index 000000000000..8bd64329e66c Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Client.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Worker.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Worker.dll new file mode 100644 index 000000000000..ea826b4fdf8b Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.DurableTask.Worker.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Configuration.Abstractions.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Configuration.Abstractions.dll new file mode 100644 index 000000000000..9a24516f399b Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Configuration.Abstractions.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.DependencyInjection.Abstractions.dll new file mode 100644 index 000000000000..b4ee93da0299 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.DependencyInjection.Abstractions.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.FileProviders.Abstractions.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.FileProviders.Abstractions.dll new file mode 100644 index 000000000000..d1045b65ad92 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.FileProviders.Abstractions.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Hosting.Abstractions.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Hosting.Abstractions.dll new file mode 100644 index 000000000000..4d33a647fda8 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Hosting.Abstractions.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Logging.Abstractions.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Logging.Abstractions.dll new file mode 100644 index 000000000000..bb27a2fcaa36 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Logging.Abstractions.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Options.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Options.dll new file mode 100644 index 000000000000..604b60275e68 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Options.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Primitives.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Primitives.dll new file mode 100644 index 000000000000..1b2c43afc495 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Microsoft.Extensions.Primitives.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Newtonsoft.Json.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Newtonsoft.Json.dll new file mode 100644 index 000000000000..1ffeabe658ac Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/Newtonsoft.Json.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Diagnostics.EventLog.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Diagnostics.EventLog.dll new file mode 100644 index 000000000000..8a65e715b96e Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Diagnostics.EventLog.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Core.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Core.dll new file mode 100644 index 000000000000..a3b43b6279c4 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Core.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Interfaces.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Interfaces.dll new file mode 100644 index 000000000000..690f6d2344cc Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Interfaces.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Linq.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Linq.dll new file mode 100644 index 000000000000..9d91f71eb09c Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Linq.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.PlatformServices.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.PlatformServices.dll new file mode 100644 index 000000000000..4ded127379bd Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.PlatformServices.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Providers.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Providers.dll new file mode 100644 index 000000000000..612587dad973 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.Providers.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.dll b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.dll new file mode 100644 index 000000000000..abaf211395a6 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/Dependencies/System.Reactive.dll differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/PSGetModuleInfo.xml b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/PSGetModuleInfo.xml new file mode 100644 index 000000000000..0ec6c4a09cbd --- /dev/null +++ b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/PSGetModuleInfo.xml @@ -0,0 +1,166 @@ + + + + Microsoft.PowerShell.Commands.PSRepositoryItemInfo + System.Management.Automation.PSCustomObject + System.Object + + + AzureFunctions.PowerShell.Durable.SDK + 1.0.2 + Module + Initial release of the Durable Functions SDK for PowerShell. This package is to be used exclusively with the Azure Functions PowerShell worker. + Microsoft Corporation + + + System.Object[] + System.Array + System.Object + + + davidmrdavid + michaelpeng + + + (c) Microsoft Corporation. All rights reserved. +
2023-09-11T21:54:10+02:00
+ + + https://github.com/Azure/azure-functions-durable-powershell/blob/main/LICENSE + https://github.com/Azure/azure-functions-durable-powershell + + + + + Microsoft + Azure + Functions + Serverless + Cloud + Workflows + Durable + DurableTask + PSModule + PSEdition_Core + + + + + System.Collections.Hashtable + System.Object + + + + RoleCapability + + + + + + + Workflow + + + + Function + + + + Get-DurableStatus + New-DurableOrchestrationCheckStatusResponse + Send-DurableExternalEvent + Start-DurableOrchestration + Stop-DurableOrchestration + + + + + Cmdlet + + + + Invoke-DurableActivity + Invoke-DurableSubOrchestrator + New-DurableRetryPolicy + Set-DurableCustomStatus + Set-FunctionInvocationContext + Start-DurableExternalEventListener + Start-DurableTimer + Stop-DurableTimerTask + Wait-DurableTask + Get-DurableTaskResult + + + + + DscResource + + + + Command + + + + Invoke-DurableActivity + Invoke-DurableSubOrchestrator + New-DurableRetryPolicy + Set-DurableCustomStatus + Set-FunctionInvocationContext + Start-DurableExternalEventListener + Start-DurableTimer + Stop-DurableTimerTask + Wait-DurableTask + Get-DurableTaskResult + Get-DurableStatus + New-DurableOrchestrationCheckStatusResponse + Send-DurableExternalEvent + Start-DurableOrchestration + Stop-DurableOrchestration + + + + + + + + + + + + https://www.powershellgallery.com/api/v2 + PSGallery + NuGet + + + System.Management.Automation.PSCustomObject + System.Object + + + (c) Microsoft Corporation. All rights reserved. + Initial release of the Durable Functions SDK for PowerShell. This package is to be used exclusively with the Azure Functions PowerShell worker. + False + True + True + 1287 + 1768 + 1382604 + 11/09/2023 21:54:10 +02:00 + 11/09/2023 21:54:10 +02:00 + 09/01/2024 13:40:21 +01:00 + Microsoft Azure Functions Serverless Cloud Workflows Durable DurableTask PSModule PSEdition_Core PSCmdlet_Invoke-DurableActivity PSCommand_Invoke-DurableActivity PSCmdlet_Invoke-DurableSubOrchestrator PSCommand_Invoke-DurableSubOrchestrator PSCmdlet_New-DurableRetryPolicy PSCommand_New-DurableRetryPolicy PSCmdlet_Set-DurableCustomStatus PSCommand_Set-DurableCustomStatus PSCmdlet_Set-FunctionInvocationContext PSCommand_Set-FunctionInvocationContext PSCmdlet_Start-DurableExternalEventListener PSCommand_Start-DurableExternalEventListener PSCmdlet_Start-DurableTimer PSCommand_Start-DurableTimer PSCmdlet_Stop-DurableTimerTask PSCommand_Stop-DurableTimerTask PSCmdlet_Wait-DurableTask PSCommand_Wait-DurableTask PSCmdlet_Get-DurableTaskResult PSCommand_Get-DurableTaskResult PSIncludes_Cmdlet PSFunction_Get-DurableStatus PSCommand_Get-DurableStatus PSFunction_New-DurableOrchestrationCheckStatusResponse PSCommand_New-DurableOrchestrationCheckStatusResponse PSFunction_Send-DurableExternalEvent PSCommand_Send-DurableExternalEvent PSFunction_Start-DurableOrchestration PSCommand_Start-DurableOrchestration PSFunction_Stop-DurableOrchestration PSCommand_Stop-DurableOrchestration PSIncludes_Function + False + 2024-01-09T13:40:21Z + 1.0.2 + Microsoft Corporation + false + Module + AzureFunctions.PowerShell.Durable.SDK.nuspec|Dependencies\Microsoft.Extensions.FileProviders.Abstractions.dll|Dependencies\Microsoft.Extensions.Options.dll|Dependencies\System.Diagnostics.EventLog.dll|Dependencies\System.Reactive.Interfaces.dll|Dependencies\System.Reactive.PlatformServices.dll|_manifest\manifest.json|AzureFunctions.PowerShell.Durable.SDK.dll|AzureFunctions.PowerShell.Durable.SDK.psd1|Dependencies\DurableEngine.dll|Dependencies\Microsoft.Bcl.AsyncInterfaces.dll|Dependencies\Microsoft.DurableTask.Worker.dll|Dependencies\Microsoft.Extensions.Hosting.Abstractions.dll|Dependencies\Microsoft.Extensions.Primitives.dll|Dependencies\System.Reactive.Core.dll|Dependencies\System.Reactive.Linq.dll|Dependencies\System.Reactive.Providers.dll|_manifest\manifest.json.sha256|_manifest\spdx_2.2\manifest.spdx.json|AzureFunctions.PowerShell.Durable.SDK.psm1|Dependencies\DurableEngine.pdb|Dependencies\Microsoft.DurableTask.Abstractions.dll|Dependencies\Microsoft.Extensions.Configuration.Abstractions.dll|Dependencies\Microsoft.Extensions.Logging.Abstractions.dll|Dependencies\Newtonsoft.Json.dll|Dependencies\System.Reactive.dll|_manifest\spdx_2.2\manifest.spdx.json.sha256|AzureFunctions.PowerShell.Durable.SDK.pdb|Dependencies\Castle.Core.dll|Dependencies\DurableTask.Core.dll|Dependencies\Microsoft.DurableTask.Client.dll|Dependencies\Microsoft.Extensions.DependencyInjection.Abstractions.dll + 841fad61-94f5-4330-89be-613d54165289 + 7.2 + Microsoft Corporation + + + C:\Github\CIPP-API\Modules\AzureFunctions.PowerShell.Durable.SDK\1.0.2 +
+
+
diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/manifest.json b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/manifest.json new file mode 100644 index 000000000000..9c4ac9d8cd22 --- /dev/null +++ b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/manifest.json @@ -0,0 +1,145 @@ +{ + "Outputs": [ + { + "Source": "/AzureFunctions.PowerShell.Durable.SDK.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "84E6FE5F74CC101E29C0CAD94E79903A1ACAB2B8179CDA011E06BEBF41DEB098" + }, + { + "Source": "/Dependencies/Microsoft.Bcl.AsyncInterfaces.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "5705D245072D3EB78400547B32147DBB6E2C8B02BA8BDA76729798F5EFDEAECB" + }, + { + "Source": "/Dependencies/Microsoft.Extensions.Logging.Abstractions.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "D575C9D1543CA726CE14DBDFFD103E93EA527CD46BB28316DA1F4122DBC55D56" + }, + { + "Source": "/Dependencies/System.Reactive.Linq.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "33EB42B7065A01963DBCD762CDC81A4135B6E0E927DDF4C88EAE121AD5F69F92" + }, + { + "Source": "/AzureFunctions.PowerShell.Durable.SDK.pdb", + "AzureArtifactsHash": "0442534A4201000100000000000C0000005044422076312E3000000000000006007C", + "Sha256Hash": "EB2C5EE08C7B8DF836BB796EC57CE1F7FA96FC9ADBDCBCC516A975A0B2F3C2F6" + }, + { + "Source": "/Dependencies/Microsoft.DurableTask.Abstractions.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "CC13EF28BE5C94860CCADF1B9D9E8E505484B1AB40D2D3F60827E14E109FEB0C" + }, + { + "Source": "/Dependencies/Microsoft.Extensions.Options.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "786112CB2F6646EF1170219A8C0BB813C9F14A6781E67C6266414F55A679565D" + }, + { + "Source": "/Dependencies/System.Reactive.PlatformServices.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "2D864B716FBAE8C1880143574332A10FBC6D98613AA09F6DD98D9D08B82B65AD" + }, + { + "Source": "/AzureFunctions.PowerShell.Durable.SDK.psd1", + "AzureArtifactsHash": "04407B202020200D0A20202020232056657273696F6E206E756D626572206F662074", + "Sha256Hash": "41125A20EE9999F330BFCFE22ABB43369D4EF568A66A4C8E006D30A110CD503D" + }, + { + "Source": "/Dependencies/Microsoft.DurableTask.Client.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "AE75348D5D809C89D700B34E9DD3826E218DBB7E9749372ABEE72939FE29C426" + }, + { + "Source": "/Dependencies/Microsoft.Extensions.Primitives.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "8CE9A85927EC7507B11FFE90080E7A811D51304A9E8B1DA20C350159BA403902" + }, + { + "Source": "/Dependencies/System.Reactive.Providers.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "79A12C5227A000F8608520F2CAB63BECC4412415A1DBEFF29179DFCAA13B6A3A" + }, + { + "Source": "/AzureFunctions.PowerShell.Durable.SDK.psm1", + "AzureArtifactsHash": "04230D0A2320436F7079726967687420286329204D6963726F736F66742E20416C6C", + "Sha256Hash": "6E1700D07C5C4E13C0959396A2880E983151F42C0560E895D90F39A673F84E30" + }, + { + "Source": "/Dependencies/Microsoft.DurableTask.Worker.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "D8D460A09A7E51C1A365883F3296394C1B86257A5235EC30DEDD597BA5F0FC49" + }, + { + "Source": "/Dependencies/Newtonsoft.Json.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "72CF291D4BAB0EDD08A9B07C6173E1E7AD1ABB7AB727FD7044BF6305D7515661" + }, + { + "Source": "/Dependencies/Castle.Core.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "ACA835865E0F0E19E5E69031D1C4C1288961CF4972C5918868ACA513CA6BCE51" + }, + { + "Source": "/Dependencies/Microsoft.Extensions.Configuration.Abstractions.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "E4EB5EB7E28A5548CD904FE1A9C3569ADEF91F52B654DB8A3C56A0A5177A09EB" + }, + { + "Source": "/Dependencies/System.Diagnostics.EventLog.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "24A02D97C2FC6D56735E196BB7FAAAE8FAF0068C486D0C3C7FA3E3B73B4F12A4" + }, + { + "Source": "/Dependencies/DurableEngine.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "B22F3247AE1C6F467585E398EA74FA371189AD584859C382F15EB22A8CB27501" + }, + { + "Source": "/Dependencies/Microsoft.Extensions.DependencyInjection.Abstractions.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "9CCD830351AA28BC683D4F8D1CEFD9E724161F972D25BFB64EEE5BF55C48C5E3" + }, + { + "Source": "/Dependencies/System.Reactive.Core.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "47411515E22254958AB719D8C312E6BF7904E32DD1869EB27BF2DDC4E590CAB4" + }, + { + "Source": "/Dependencies/DurableEngine.pdb", + "AzureArtifactsHash": "0442534A4201000100000000000C0000005044422076312E3000000000000006007C", + "Sha256Hash": "70C98CA32E3A42EAEB10210BFF55E294B2404121C474D0B13BAA31F78EFD6A4C" + }, + { + "Source": "/Dependencies/Microsoft.Extensions.FileProviders.Abstractions.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "ECFCEF11C42FA4AD5CF2D4D7F553C8F0017E5EB7A4A9B032B4D0505C98EF4EF4" + }, + { + "Source": "/Dependencies/System.Reactive.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "19F0112CD1F5172EE2688E96DDD44ADA39A4BB1CB2315A154B63E9064F6E3DC0" + }, + { + "Source": "/Dependencies/DurableTask.Core.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "7AA8BB6481F2C61D220A73CD2DA77ADB2D2D28DF1FA02E093DDA3A29A55DC514" + }, + { + "Source": "/Dependencies/Microsoft.Extensions.Hosting.Abstractions.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "DF9EB42421A85F84FF2FC98EA25C23FD7D8813DF23F3AFE28E96B83CC302C8A6" + }, + { + "Source": "/Dependencies/System.Reactive.Interfaces.dll", + "AzureArtifactsHash": "044D5A90000300000004000000FFFF0000B800000000000000400000000000000000", + "Sha256Hash": "EDEE1397E02DF23F85D0B242BB098C850D64CD6CA860AABB34426253A6E3ADAB" + } + ], + "CloudBuildId": "152449", + "Repo": "https://github.com/Azure/azure-functions-durable-powershell", + "Branch": "main", + "CommitId": "959cf1afea08beebfc65f0761ece404506b20499", + "Version": "0.0.1", + "Timestamp": 1694466518 +} \ No newline at end of file diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/manifest.json.sha256 b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/manifest.json.sha256 new file mode 100644 index 000000000000..d55198ec3e0a Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/manifest.json.sha256 differ diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/spdx_2.2/manifest.spdx.json b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/spdx_2.2/manifest.spdx.json new file mode 100644 index 000000000000..999a518b3e8f --- /dev/null +++ b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/spdx_2.2/manifest.spdx.json @@ -0,0 +1,614 @@ +{ + "files": [ + { + "fileName": "./AzureFunctions.PowerShell.Durable.SDK.dll", + "SPDXID": "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.dll-0CA57E1F20DC5E1F8BF8C27C7ABB781FD7E2C96F", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "84e6fe5f74cc101e29c0cad94e79903a1acab2b8179cda011e06bebf41deb098" + }, + { + "algorithm": "SHA1", + "checksumValue": "0ca57e1f20dc5e1f8bf8c27c7abb781fd7e2c96f" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Bcl.AsyncInterfaces.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Bcl.AsyncInterfaces.dll-2E438AEF830795B2D240CF3160A3353BC6CB0232", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "5705d245072d3eb78400547b32147dbb6e2c8b02ba8bda76729798f5efdeaecb" + }, + { + "algorithm": "SHA1", + "checksumValue": "2e438aef830795b2d240cf3160a3353bc6cb0232" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Extensions.Logging.Abstractions.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Extensions.Logging.Abstractions.dll-02EC010722BBD1740782B502DF30D4475AEBE5F2", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "d575c9d1543ca726ce14dbdffd103e93ea527cd46bb28316da1f4122dbc55d56" + }, + { + "algorithm": "SHA1", + "checksumValue": "02ec010722bbd1740782b502df30d4475aebe5f2" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/System.Reactive.Linq.dll", + "SPDXID": "SPDXRef-File--Dependencies-System.Reactive.Linq.dll-21B3C0F5AE5F6C6A436ECC37E747BF931C141D14", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "33eb42b7065a01963dbcd762cdc81a4135b6e0e927ddf4c88eae121ad5f69f92" + }, + { + "algorithm": "SHA1", + "checksumValue": "21b3c0f5ae5f6c6a436ecc37e747bf931c141d14" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./AzureFunctions.PowerShell.Durable.SDK.pdb", + "SPDXID": "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.pdb-A8404C06CFD62F8B32E7333255E790198FB7710B", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "eb2c5ee08c7b8df836bb796ec57ce1f7fa96fc9adbdcbcc516a975a0b2f3c2f6" + }, + { + "algorithm": "SHA1", + "checksumValue": "a8404c06cfd62f8b32e7333255e790198fb7710b" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.DurableTask.Abstractions.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.DurableTask.Abstractions.dll-D1D43D1F5B80C63EF1E52985922BB90ADEA5DEEC", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "cc13ef28be5c94860ccadf1b9d9e8e505484b1ab40d2d3f60827e14e109feb0c" + }, + { + "algorithm": "SHA1", + "checksumValue": "d1d43d1f5b80c63ef1e52985922bb90adea5deec" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Extensions.Options.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Extensions.Options.dll-6EC0C1FE1332912086247080B55B06623C78326E", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "786112cb2f6646ef1170219a8c0bb813c9f14a6781e67c6266414f55a679565d" + }, + { + "algorithm": "SHA1", + "checksumValue": "6ec0c1fe1332912086247080b55b06623c78326e" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/System.Reactive.PlatformServices.dll", + "SPDXID": "SPDXRef-File--Dependencies-System.Reactive.PlatformServices.dll-8A33FDD641185C66DD4FD3DB88DF5504621D3BF4", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "2d864b716fbae8c1880143574332a10fbc6d98613aa09f6dd98d9d08b82b65ad" + }, + { + "algorithm": "SHA1", + "checksumValue": "8a33fdd641185c66dd4fd3db88df5504621d3bf4" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./AzureFunctions.PowerShell.Durable.SDK.psd1", + "SPDXID": "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.psd1-D7759B5867DEBC3071327666924C1CC70028F2F1", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "41125a20ee9999f330bfcfe22abb43369d4ef568a66a4c8e006d30a110cd503d" + }, + { + "algorithm": "SHA1", + "checksumValue": "d7759b5867debc3071327666924c1cc70028f2f1" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.DurableTask.Client.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.DurableTask.Client.dll-0DE9E1C4F3587BC9C002F935BA5023890ED18B8F", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "ae75348d5d809c89d700b34e9dd3826e218dbb7e9749372abee72939fe29c426" + }, + { + "algorithm": "SHA1", + "checksumValue": "0de9e1c4f3587bc9c002f935ba5023890ed18b8f" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Extensions.Primitives.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Extensions.Primitives.dll-376636C20CEE083DA54D4146479032170EC7231B", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "8ce9a85927ec7507b11ffe90080e7a811d51304a9e8b1da20c350159ba403902" + }, + { + "algorithm": "SHA1", + "checksumValue": "376636c20cee083da54d4146479032170ec7231b" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/System.Reactive.Providers.dll", + "SPDXID": "SPDXRef-File--Dependencies-System.Reactive.Providers.dll-74AA6DBBCB5397BB09D1E69FFCFE9526CBFCEB44", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "79a12c5227a000f8608520f2cab63becc4412415a1dbeff29179dfcaa13b6a3a" + }, + { + "algorithm": "SHA1", + "checksumValue": "74aa6dbbcb5397bb09d1e69ffcfe9526cbfceb44" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./AzureFunctions.PowerShell.Durable.SDK.psm1", + "SPDXID": "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.psm1-852079516A56958CFCFFE5EEFCF7B0C10BD163F6", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "6e1700d07c5c4e13c0959396a2880e983151f42c0560e895d90f39a673f84e30" + }, + { + "algorithm": "SHA1", + "checksumValue": "852079516a56958cfcffe5eefcf7b0c10bd163f6" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.DurableTask.Worker.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.DurableTask.Worker.dll-D3C716C746EB41567EB15E92313871FF5DF6FE1E", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "d8d460a09a7e51c1a365883f3296394c1b86257a5235ec30dedd597ba5f0fc49" + }, + { + "algorithm": "SHA1", + "checksumValue": "d3c716c746eb41567eb15e92313871ff5df6fe1e" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Newtonsoft.Json.dll", + "SPDXID": "SPDXRef-File--Dependencies-Newtonsoft.Json.dll-E3673D05D46F29E68241D4536BDDF18CDD0A913D", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "72cf291d4bab0edd08a9b07c6173e1e7ad1abb7ab727fd7044bf6305d7515661" + }, + { + "algorithm": "SHA1", + "checksumValue": "e3673d05d46f29e68241d4536bddf18cdd0a913d" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Castle.Core.dll", + "SPDXID": "SPDXRef-File--Dependencies-Castle.Core.dll-EFB41379A448DA4C368F5694D0675F99662D27C6", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "aca835865e0f0e19e5e69031d1c4c1288961cf4972c5918868aca513ca6bce51" + }, + { + "algorithm": "SHA1", + "checksumValue": "efb41379a448da4c368f5694d0675f99662d27c6" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Extensions.Configuration.Abstractions.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Extensions.Configuration.Abstractions.dll-C524C7D46A343B75A64BF52B19E3C70C453F9061", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "e4eb5eb7e28a5548cd904fe1a9c3569adef91f52b654db8a3c56a0a5177a09eb" + }, + { + "algorithm": "SHA1", + "checksumValue": "c524c7d46a343b75a64bf52b19e3c70c453f9061" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/System.Diagnostics.EventLog.dll", + "SPDXID": "SPDXRef-File--Dependencies-System.Diagnostics.EventLog.dll-96A914148520A9F0AB3733410129FFB7BA2992CC", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "24a02d97c2fc6d56735e196bb7faaae8faf0068c486d0c3c7fa3e3b73b4f12a4" + }, + { + "algorithm": "SHA1", + "checksumValue": "96a914148520a9f0ab3733410129ffb7ba2992cc" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/DurableEngine.dll", + "SPDXID": "SPDXRef-File--Dependencies-DurableEngine.dll-A69A399F97F3634DE3171BAAADE07CFC1549C98D", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "b22f3247ae1c6f467585e398ea74fa371189ad584859c382f15eb22a8cb27501" + }, + { + "algorithm": "SHA1", + "checksumValue": "a69a399f97f3634de3171baaade07cfc1549c98d" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Extensions.DependencyInjection.Abstractions.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Extensions.DependencyInjection.Abstractions.dll-CB8C35306AFD15358104ECFE70E724AD9C753E6F", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "9ccd830351aa28bc683d4f8d1cefd9e724161f972d25bfb64eee5bf55c48c5e3" + }, + { + "algorithm": "SHA1", + "checksumValue": "cb8c35306afd15358104ecfe70e724ad9c753e6f" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/System.Reactive.Core.dll", + "SPDXID": "SPDXRef-File--Dependencies-System.Reactive.Core.dll-A91898005B1CC48E3F6A4CBB835CAFFC8C6A85CB", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "47411515e22254958ab719d8c312e6bf7904e32dd1869eb27bf2ddc4e590cab4" + }, + { + "algorithm": "SHA1", + "checksumValue": "a91898005b1cc48e3f6a4cbb835caffc8c6a85cb" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/DurableEngine.pdb", + "SPDXID": "SPDXRef-File--Dependencies-DurableEngine.pdb-840296DC42A039DE16DAFD9B6108ACB93E637148", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "70c98ca32e3a42eaeb10210bff55e294b2404121c474d0b13baa31f78efd6a4c" + }, + { + "algorithm": "SHA1", + "checksumValue": "840296dc42a039de16dafd9b6108acb93e637148" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Extensions.FileProviders.Abstractions.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Extensions.FileProviders.Abstractions.dll-3029F45A1397291B4E7EEE9DB9B5DCDE5A47AB7D", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "ecfcef11c42fa4ad5cf2d4d7f553c8f0017e5eb7a4a9b032b4d0505c98ef4ef4" + }, + { + "algorithm": "SHA1", + "checksumValue": "3029f45a1397291b4e7eee9db9b5dcde5a47ab7d" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/System.Reactive.dll", + "SPDXID": "SPDXRef-File--Dependencies-System.Reactive.dll-9CBCA70CC79F7476D92B481C6BEC46CE85433328", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "19f0112cd1f5172ee2688e96ddd44ada39a4bb1cb2315a154b63e9064f6e3dc0" + }, + { + "algorithm": "SHA1", + "checksumValue": "9cbca70cc79f7476d92b481c6bec46ce85433328" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/DurableTask.Core.dll", + "SPDXID": "SPDXRef-File--Dependencies-DurableTask.Core.dll-0064DA99C6E1C6FED54FAB9396878975A1D28EAF", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "7aa8bb6481f2c61d220a73cd2da77adb2d2d28df1fa02e093dda3a29a55dc514" + }, + { + "algorithm": "SHA1", + "checksumValue": "0064da99c6e1c6fed54fab9396878975a1d28eaf" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/Microsoft.Extensions.Hosting.Abstractions.dll", + "SPDXID": "SPDXRef-File--Dependencies-Microsoft.Extensions.Hosting.Abstractions.dll-BBA99CBFE0EFD265CA5A2563624884D4F88BA0C3", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "df9eb42421a85f84ff2fc98ea25c23fd7d8813df23f3afe28e96b83cc302c8a6" + }, + { + "algorithm": "SHA1", + "checksumValue": "bba99cbfe0efd265ca5a2563624884d4f88ba0c3" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + }, + { + "fileName": "./Dependencies/System.Reactive.Interfaces.dll", + "SPDXID": "SPDXRef-File--Dependencies-System.Reactive.Interfaces.dll-74F54702F12252A2DAC2D87D89809C7A1A475F81", + "checksums": [ + { + "algorithm": "SHA256", + "checksumValue": "edee1397e02df23f85d0b242bb098c850d64cd6ca860aabb34426253a6e3adab" + }, + { + "algorithm": "SHA1", + "checksumValue": "74f54702f12252a2dac2d87d89809c7a1a475f81" + } + ], + "licenseConcluded": "NOASSERTION", + "licenseInfoInFiles": [ + "NOASSERTION" + ], + "copyrightText": "NOASSERTION" + } + ], + "packages": [ + { + "name": "Azure Pipelines Hosted Image win19", + "SPDXID": "SPDXRef-Package-3FF606431CE825232B7BA4675B710470193C4F32ADA943301C6DB7DEEC27B080", + "downloadLocation": "NOASSERTION", + "filesAnalyzed": false, + "licenseConcluded": "NOASSERTION", + "licenseInfoFromFiles": [ + "NOASSERTION" + ], + "licenseDeclared": "NOASSERTION", + "copyrightText": "NOASSERTION", + "versionInfo": "20230820.1.0", + "externalRefs": [ + { + "referenceCategory": "PACKAGE_MANAGER", + "referenceType": "purl", + "referenceLocator": "https://github.com/actions/virtual-environments" + } + ], + "supplier": "Microsoft/GitHub" + }, + { + "name": "AzureFunctions.PowerShell.Durable.SDK", + "SPDXID": "SPDXRef-RootPackage", + "downloadLocation": "NOASSERTION", + "packageVerificationCode": { + "packageVerificationCodeValue": "c909f8fe42dbc3758acaf989869053a1b30779e8" + }, + "filesAnalyzed": true, + "licenseConcluded": "NOASSERTION", + "licenseInfoFromFiles": [ + "NOASSERTION" + ], + "licenseDeclared": "NOASSERTION", + "copyrightText": "NOASSERTION", + "versionInfo": "152449", + "supplier": "Organization: Microsoft", + "hasFiles": [ + "SPDXRef-File--Dependencies-System.Diagnostics.EventLog.dll-96A914148520A9F0AB3733410129FFB7BA2992CC", + "SPDXRef-File--Dependencies-Microsoft.Extensions.Configuration.Abstractions.dll-C524C7D46A343B75A64BF52B19E3C70C453F9061", + "SPDXRef-File--Dependencies-Castle.Core.dll-EFB41379A448DA4C368F5694D0675F99662D27C6", + "SPDXRef-File--Dependencies-System.Reactive.Linq.dll-21B3C0F5AE5F6C6A436ECC37E747BF931C141D14", + "SPDXRef-File--Dependencies-Microsoft.Extensions.Logging.Abstractions.dll-02EC010722BBD1740782B502DF30D4475AEBE5F2", + "SPDXRef-File--Dependencies-Microsoft.Bcl.AsyncInterfaces.dll-2E438AEF830795B2D240CF3160A3353BC6CB0232", + "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.dll-0CA57E1F20DC5E1F8BF8C27C7ABB781FD7E2C96F", + "SPDXRef-File--Dependencies-Newtonsoft.Json.dll-E3673D05D46F29E68241D4536BDDF18CDD0A913D", + "SPDXRef-File--Dependencies-Microsoft.DurableTask.Worker.dll-D3C716C746EB41567EB15E92313871FF5DF6FE1E", + "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.psm1-852079516A56958CFCFFE5EEFCF7B0C10BD163F6", + "SPDXRef-File--Dependencies-System.Reactive.PlatformServices.dll-8A33FDD641185C66DD4FD3DB88DF5504621D3BF4", + "SPDXRef-File--Dependencies-Microsoft.Extensions.Options.dll-6EC0C1FE1332912086247080B55B06623C78326E", + "SPDXRef-File--Dependencies-Microsoft.DurableTask.Abstractions.dll-D1D43D1F5B80C63EF1E52985922BB90ADEA5DEEC", + "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.pdb-A8404C06CFD62F8B32E7333255E790198FB7710B", + "SPDXRef-File--Dependencies-System.Reactive.Interfaces.dll-74F54702F12252A2DAC2D87D89809C7A1A475F81", + "SPDXRef-File--Dependencies-Microsoft.Extensions.Hosting.Abstractions.dll-BBA99CBFE0EFD265CA5A2563624884D4F88BA0C3", + "SPDXRef-File--Dependencies-DurableTask.Core.dll-0064DA99C6E1C6FED54FAB9396878975A1D28EAF", + "SPDXRef-File--Dependencies-System.Reactive.dll-9CBCA70CC79F7476D92B481C6BEC46CE85433328", + "SPDXRef-File--Dependencies-Microsoft.Extensions.FileProviders.Abstractions.dll-3029F45A1397291B4E7EEE9DB9B5DCDE5A47AB7D", + "SPDXRef-File--Dependencies-DurableEngine.pdb-840296DC42A039DE16DAFD9B6108ACB93E637148", + "SPDXRef-File--Dependencies-System.Reactive.Core.dll-A91898005B1CC48E3F6A4CBB835CAFFC8C6A85CB", + "SPDXRef-File--Dependencies-Microsoft.Extensions.DependencyInjection.Abstractions.dll-CB8C35306AFD15358104ECFE70E724AD9C753E6F", + "SPDXRef-File--Dependencies-DurableEngine.dll-A69A399F97F3634DE3171BAAADE07CFC1549C98D", + "SPDXRef-File--Dependencies-System.Reactive.Providers.dll-74AA6DBBCB5397BB09D1E69FFCFE9526CBFCEB44", + "SPDXRef-File--Dependencies-Microsoft.Extensions.Primitives.dll-376636C20CEE083DA54D4146479032170EC7231B", + "SPDXRef-File--Dependencies-Microsoft.DurableTask.Client.dll-0DE9E1C4F3587BC9C002F935BA5023890ED18B8F", + "SPDXRef-File--AzureFunctions.PowerShell.Durable.SDK.psd1-D7759B5867DEBC3071327666924C1CC70028F2F1" + ] + } + ], + "externalDocumentRefs": [], + "relationships": [ + { + "relationshipType": "DESCRIBES", + "relatedSpdxElement": "SPDXRef-RootPackage", + "spdxElementId": "SPDXRef-DOCUMENT" + }, + { + "relationshipType": "DEPENDS_ON", + "relatedSpdxElement": "SPDXRef-Package-3FF606431CE825232B7BA4675B710470193C4F32ADA943301C6DB7DEEC27B080", + "spdxElementId": "SPDXRef-RootPackage" + } + ], + "spdxVersion": "SPDX-2.2", + "dataLicense": "CC0-1.0", + "SPDXID": "SPDXRef-DOCUMENT", + "name": "AzureFunctions.PowerShell.Durable.SDK 152449", + "documentNamespace": "https://sbom.microsoft/1:vB_F0XdED0q5n_yQEwCaWA:kgyn5ihBn0OAEjgv541jlg/110:152449/zvvi4k5neU2-Hp8eZHDSOw", + "creationInfo": { + "created": "2023-09-11T21:08:38Z", + "creators": [ + "Organization: Microsoft", + "Tool: Microsoft.SBOMTool-2.1.31" + ] + }, + "documentDescribes": [ + "SPDXRef-RootPackage" + ] +} \ No newline at end of file diff --git a/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/spdx_2.2/manifest.spdx.json.sha256 b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/spdx_2.2/manifest.spdx.json.sha256 new file mode 100644 index 000000000000..bcbc6eb1b1b5 Binary files /dev/null and b/Modules/AzureFunctions.PowerShell.Durable.SDK/1.0.2/_manifest/spdx_2.2/manifest.spdx.json.sha256 differ diff --git a/Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1 b/Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1 index 81c0bdd6761a..52e790757b9b 100644 --- a/Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1 +++ b/Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1 @@ -5,13 +5,16 @@ function Add-CIPPApplicationPermission { $ApplicationId, $Tenantfilter ) + if ($ApplicationId -eq $ENV:ApplicationID -and $Tenantfilter -eq $env:TenantID) { + return @('Cannot modify application permissions for CIPP-SAM on partner tenant') + } Set-Location (Get-Item $PSScriptRoot).FullName - if ($RequiredResourceAccess -eq "CIPPDefaults") { + if ($RequiredResourceAccess -eq 'CIPPDefaults') { $RequiredResourceAccess = (Get-Content '.\SAMManifest.json' | ConvertFrom-Json).requiredResourceAccess } $ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -skipTokenCache $true -tenantid $Tenantfilter $ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property AppId -EQ $ApplicationId - if(!$ourSVCPrincipal) { + if (!$ourSVCPrincipal) { #Our Service Principal isn't available yet. We do a sleep and reexecute after 3 seconds. Start-Sleep -Seconds 5 $ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -skipTokenCache $true -tenantid $Tenantfilter @@ -19,28 +22,27 @@ function Add-CIPPApplicationPermission { } $Results = [System.Collections.ArrayList]@() - + $CurrentRoles = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignments" -tenantid $Tenantfilter -skipTokenCache $true - - $Grants = foreach ($App in $RequiredResourceAccess) { + + $Grants = foreach ($App in $RequiredResourceAccess) { $svcPrincipalId = $ServicePrincipalList | Where-Object -Property AppId -EQ $App.resourceAppId - if (!$svcPrincipalId) { continue } - foreach ($SingleResource in $App.ResourceAccess | Where-Object -Property Type -EQ "Role") { + if (!$svcPrincipalId) { continue } + foreach ($SingleResource in $App.ResourceAccess | Where-Object -Property Type -EQ 'Role') { if ($SingleResource.id -In $CurrentRoles.appRoleId) { continue } [pscustomobject]@{ principalId = $($ourSVCPrincipal.id) resourceId = $($svcPrincipalId.id) appRoleId = "$($SingleResource.Id)" } - } - } + } + } $counter = 0 foreach ($Grant in $Grants) { try { - $SettingsRequest = New-GraphPOSTRequest -body ($Grant | ConvertTo-Json) -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignedTo" -tenantid $Tenantfilter -type POST + $SettingsRequest = New-GraphPOSTRequest -body ($Grant | ConvertTo-Json) -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/appRoleAssignedTo" -tenantid $Tenantfilter -type POST $counter ++ - } - catch { + } catch { $Results.add("Failed to grant $($Grant.appRoleId) to $($Grant.resourceId): $($_.Exception.Message)") | Out-Null } } diff --git a/Modules/CIPPCore/Public/Add-CIPPDelegatedPermission.ps1 b/Modules/CIPPCore/Public/Add-CIPPDelegatedPermission.ps1 index bc0dfe9046bf..1121922c2586 100644 --- a/Modules/CIPPCore/Public/Add-CIPPDelegatedPermission.ps1 +++ b/Modules/CIPPCore/Public/Add-CIPPDelegatedPermission.ps1 @@ -7,7 +7,11 @@ function Add-CIPPDelegatedPermission { ) Write-Host 'Adding Delegated Permissions' Set-Location (Get-Item $PSScriptRoot).FullName - Write-Host "RequiredResourceAccess: $($RequiredResourceAccess | ConvertTo-Json -Depth 10)" + + if ($ApplicationId -eq $ENV:ApplicationID -and $Tenantfilter -eq $env:TenantID) { + return @('Cannot modify delgated permissions for CIPP-SAM on partner tenant') + } + if ($RequiredResourceAccess -eq 'CIPPDefaults') { $RequiredResourceAccess = (Get-Content '.\SAMManifest.json' | ConvertFrom-Json).requiredResourceAccess } @@ -15,15 +19,15 @@ function Add-CIPPDelegatedPermission { $ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -tenantid $Tenantfilter -skipTokenCache $true $ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property AppId -EQ $ApplicationId $Results = [System.Collections.ArrayList]@() - + $CurrentDelegatedScopes = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals/$($ourSVCPrincipal.id)/oauth2PermissionGrants" -skipTokenCache $true -tenantid $Tenantfilter - + foreach ($App in $requiredResourceAccess) { $svcPrincipalId = $ServicePrincipalList | Where-Object -Property AppId -EQ $App.resourceAppId - if (!$svcPrincipalId) { continue } + if (!$svcPrincipalId) { continue } $NewScope = ($Translator | Where-Object { $_.id -in $App.ResourceAccess.id } | Where-Object { $_.value -notin 'profile', 'openid', 'offline_access' }).value -join ' ' $OldScope = ($CurrentDelegatedScopes | Where-Object -Property Resourceid -EQ $svcPrincipalId.id) - + if (!$OldScope) { $Createbody = @{ clientId = $ourSVCPrincipal.id diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecGDAPInvite.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecGDAPInvite.ps1 index b427e3e89e2b..ff9a8d856843 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecGDAPInvite.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ExecGDAPInvite.ps1 @@ -48,7 +48,8 @@ Function Invoke-ExecGDAPInvite { if ($NewRelationshipRequest.action -eq 'lockForApproval') { $InviteUrl = "https://admin.microsoft.com/AdminPortal/Home#/partners/invitation/granularAdminRelationships/$($NewRelationship.id)" $Uri = ([System.Uri]$TriggerMetadata.Headers.referer) - $OnboardingUrl = $Uri.AbsoluteUri.Replace($Uri.PathAndQuery, '/tenant/administration/tenant-onboarding-wizard?tableFilter=Complex: id eq {0}' -f $NewRelationship.id) + $TableFilter = [System.Web.HttpUtility]::UrlEncode(('Complex: id eq {0}' -f $NewRelationship.id)) + $OnboardingUrl = $Uri.AbsoluteUri.Replace($Uri.PathAndQuery, "/tenant/administration/tenant-onboarding-wizard?tableFilter=$TableFilter") $InviteEntity = [PSCustomObject]@{ 'PartitionKey' = 'invite' diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAlertsQueue.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAlertsQueue.ps1 index af4f752ac582..8d12a5c8f94d 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAlertsQueue.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListAlertsQueue.ps1 @@ -37,7 +37,7 @@ Function Invoke-ListAlertsQueue { DepTokenExpiry = [bool]$QueueFile.DepTokenExpiry NoCAConfig = [bool]$QueueFile.NoCAConfig SecDefaultsUpsell = [bool]$QueueFile.SecDefaultsUpsell - SharepointQuota = [bool]$QueueFile.SharePointQuota + SharePointQuota = [bool]$QueueFile.SharePointQuota ExpiringLicenses = [bool]$QueueFile.ExpiringLicenses tenantId = $QueueFile.tenantid } diff --git a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListSites.ps1 b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListSites.ps1 index f224af6d2282..e9d932125744 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Invoke-ListSites.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Invoke-ListSites.ps1 @@ -27,8 +27,6 @@ Function Invoke-ListSites { } else { $ParsedRequest = $Result } - - $GraphRequest = $ParsedRequest | Select-Object @{ Name = 'UPN'; Expression = { $_.'Owner Principal Name' } }, @{ Name = 'displayName'; Expression = { $_.'Owner Display Name' } }, @{ Name = 'LastActive'; Expression = { $_.'Last Activity Date' } }, @@ -36,7 +34,22 @@ Function Invoke-ListSites { @{ Name = 'UsedGB'; Expression = { [math]::round($_.'Storage Used (Byte)' / 1GB, 2) } }, @{ Name = 'URL'; Expression = { $_.'Site URL' } }, @{ Name = 'Allocated'; Expression = { [math]::round($_.'Storage Allocated (Byte)' / 1GB, 2) } }, - @{ Name = 'Template'; Expression = { $_.'Root Web Template' } } + @{ Name = 'Template'; Expression = { $_.'Root Web Template' } }, + @{ Name = 'siteid'; Expression = { $_.'site Id' } } + + #Temporary workaround for url as report is broken. + if ($Type -eq 'SharePointSiteUsage') { + $URLs = (New-GraphGetRequest -uri "https://graph.microsoft.com/v1.0/sites?search=*&`$select=sharepointIds" -asapp $true -tenantid $TenantFilter).sharepointIds + } else { + #Get all OneDrive Urls + #$URLs = (New-GraphGetRequest -uri "https://graph.microsoft.com/v1.0/users?`$select=displayName,userPrincipalName" -tenantid $TenantFilter) + } + + $GraphRequest = foreach ($site in $GraphRequest) { + $site.URL = ($URLs | Where-Object { $_.siteId -eq $site.SiteId }).siteUrl + $site + } + $StatusCode = [HttpStatusCode]::OK } catch { $ErrorMessage = Get-NormalizedError -Message $_.Exception.Message diff --git a/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 b/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 index e1f94df1fa8d..16d810b82f09 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertExpiringLicenses.ps1 @@ -6,8 +6,12 @@ function Push-CIPPAlertExpiringLicenses { $TriggerMetadata ) try { - Get-CIPPLicenseOverview -TenantFilter $QueueItem.tenant | Where-Object -Property 'TimeUntilRenew' -LT 29 | ForEach-Object { - Write-AlertMessage -tenant $($QueueItem.tenant) -message "$($_.License) will expire in $($_.TimeUntilRenew) days. The estimated term is $($_.EstTerm)" + Get-CIPPLicenseOverview -TenantFilter $QueueItem.tenant | ForEach-Object { + $timeTorenew = [int64]$_.TimeUntilRenew + if ($timeTorenew -lt 30 -and $_.TimeUntilRenew -gt 0) { + Write-Host "$($_.License) will expire in $($_.TimeUntilRenew) days. The estimated term is $($_.EstTerm)" + Write-AlertMessage -tenant $($QueueItem.tenant) -message "$($_.License) will expire in $($_.TimeUntilRenew) days. The estimated term is $($_.EstTerm)" + } } } catch { Write-AlertMessage -tenant $($QueueItem.tenant) -message "Error occurred: $(Get-NormalizedError -message $_.Exception.message)" diff --git a/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertMFAAdmins.ps1 b/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertMFAAdmins.ps1 index db17b8b2556c..cdf0eaac34ff 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertMFAAdmins.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Push-CIPPAlertMFAAdmins.ps1 @@ -38,13 +38,14 @@ function Push-CIPPAlertMFAAdmins { } else { Write-LogMessage -message 'Potentially using Duo for MFA, could not check MFA status for Admins with 100% accuracy' -API 'MFA Alerts - Informational' -tenant $QueueItem.tenant -sev Info } + $LastRun = @{ + RowKey = 'MFAAllAdmins' + PartitionKey = $QueueItem.tenantid + } + Add-CIPPAzDataTableEntity @LastRunTable -Entity $LastRun -Force } } catch { Write-AlertMessage -tenant $($QueueItem.tenant) -message "Could not get MFA status for admins for $($QueueItem.tenant): $(Get-NormalizedError -message $_.Exception.message)" } - $LastRun = @{ - RowKey = 'MFAAllAdmins' - PartitionKey = $QueueItem.tenantid - } - Add-CIPPAzDataTableEntity @LastRunTable -Entity $LastRun -Force + } \ No newline at end of file diff --git a/Modules/CIPPCore/Public/Entrypoints/Push-ExecOnboardTenantQueue.ps1 b/Modules/CIPPCore/Public/Entrypoints/Push-ExecOnboardTenantQueue.ps1 index 1c507e0ee57f..1ed88b340cc4 100644 --- a/Modules/CIPPCore/Public/Entrypoints/Push-ExecOnboardTenantQueue.ps1 +++ b/Modules/CIPPCore/Public/Entrypoints/Push-ExecOnboardTenantQueue.ps1 @@ -216,12 +216,10 @@ Function Push-ExecOnboardTenantQueue { $OnboardingSteps.Step3.Message = 'Failed to map security groups, no pending invite available' } - $x = 0 do { - $x++ $AccessAssignments = New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/tenantRelationships/delegatedAdminRelationships/$Id/accessAssignments" Start-Sleep -Seconds 15 - } while ($AccessAssignments.status -contains 'pending' -and $x -le 12) + } while ($AccessAssignments.status -contains 'pending' -and (Get-Date) -lt $Start.AddMinutes(8)) if ($AccessAssignments.status -notcontains 'pending') { $OnboardingSteps.Step3.Message = 'Group check: Access assignments are mapped and active' diff --git a/Modules/CIPPCore/Public/New-CIPPGraphSubscription.ps1 b/Modules/CIPPCore/Public/New-CIPPGraphSubscription.ps1 index 6af3225124cb..16877c1e6524 100644 --- a/Modules/CIPPCore/Public/New-CIPPGraphSubscription.ps1 +++ b/Modules/CIPPCore/Public/New-CIPPGraphSubscription.ps1 @@ -22,9 +22,10 @@ function New-CIPPGraphSubscription { foreach ($EventType in $EventTypes) { $CIPPID = (New-Guid).GUID $Resource = $EventType + $CIPPAuditURL = "$BaseURL/API/Publicwebhooks?EventType=$EventType&CIPPID=$CIPPID" $AuditLogParams = @{ webhook = @{ - 'address' = "$BaseURL/API/Publicwebhooks?EventType=$EventType&CIPPID=$CIPPID" + 'address' = $CIPPAuditURL } } | ConvertTo-Json #List existing webhook subscriptions in table @@ -33,15 +34,17 @@ function New-CIPPGraphSubscription { $MatchedWebhook = $ExistingWebhooks | Where-Object { $_.Resource -eq $Resource } try { if (!$MatchedWebhook) { - $AuditLog = New-GraphPOSTRequest -uri "https://manage.office.com/api/v1.0/$($TenantFilter)/activity/feed/subscriptions/start?contentType=$EventType&PublisherIdentifier=$($TenantFilter)" -tenantid $TenantFilter -type POST -scope 'https://manage.office.com/.default' -body $AuditLogparams -verbose $WebhookRow = @{ PartitionKey = [string]$TenantFilter RowKey = [string]$CIPPID Resource = $Resource Expiration = 'Does Not Expire' - WebhookNotificationUrl = [string]$Auditlog.webhook.address + WebhookNotificationUrl = [string]$CIPPAuditURL } - $null = Add-CIPPAzDataTableEntity @WebhookTable -Entity $WebhookRow + Add-CIPPAzDataTableEntity @WebhookTable -Entity $WebhookRow + + $AuditLog = New-GraphPOSTRequest -uri "https://manage.office.com/api/v1.0/$($TenantFilter)/activity/feed/subscriptions/start?contentType=$EventType&PublisherIdentifier=$($TenantFilter)" -tenantid $TenantFilter -type POST -scope 'https://manage.office.com/.default' -body $AuditLogparams -verbose + Write-LogMessage -user $ExecutingUser -API $APIName -message "Created Webhook subscription for $($TenantFilter) for the log $($EventType)" -Sev 'Info' -tenant $TenantFilter } else { Write-LogMessage -user $ExecutingUser -API $APIName -message "No webhook creation required for $($TenantFilter). Already exists" -Sev 'Info' -tenant $TenantFilter @@ -50,6 +53,7 @@ function New-CIPPGraphSubscription { if ($_.Exception.Message -like '*already exists*') { Write-LogMessage -user $ExecutingUser -API $APIName -message "Webhook subscription for $($TenantFilter) already exists" -Sev 'Info' -tenant $TenantFilter } else { + Remove-AzDataTableEntity @WebhookTable -Entity @{ PartitionKey = $TenantFilter; RowKey = $CIPPID } | Out-Null Write-LogMessage -user $ExecutingUser -API $APIName -message "Failed to create Webhook Subscription for $($TenantFilter): $($_.Exception.Message)" -Sev 'Error' -tenant $TenantFilter } } diff --git a/Modules/CIPPCore/Public/Set-CIPPCPVConsent.ps1 b/Modules/CIPPCore/Public/Set-CIPPCPVConsent.ps1 index 8de89293b96c..35a90d7f9e90 100644 --- a/Modules/CIPPCore/Public/Set-CIPPCPVConsent.ps1 +++ b/Modules/CIPPCore/Public/Set-CIPPCPVConsent.ps1 @@ -11,6 +11,10 @@ function Set-CIPPCPVConsent { $TenantName = $Tenant.defaultDomainName $TenantFilter = $Tenant.customerId + if ($Tenantfilter -eq $env:TenantID) { + return @('Cannot modify CPV consent on partner tenant') + } + if ($ResetSP) { try { $DeleteSP = New-GraphpostRequest -Type DELETE -noauthcheck $true -uri "https://api.partnercenter.microsoft.com/v1/customers/$($TenantFilter)/applicationconsents/$($ENV:applicationId)" -scope 'https://api.partnercenter.microsoft.com/.default' -tenantid $env:TenantID @@ -51,7 +55,19 @@ function Set-CIPPCPVConsent { } catch { $ErrorMessage = Get-NormalizedError -message $_.Exception.Message - if ($ErrorMessage -like '*Permission entry already exists*') { return @("We've already added our Service Principal to $($TenantName)") } + if ($ErrorMessage -like '*Permission entry already exists*') { + $Table = Get-CIPPTable -TableName cpvtenants + $unixtime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds + $GraphRequest = @{ + LastApply = "$unixtime" + applicationId = "$($ENV:applicationId)" + Tenant = "$($tenantfilter)" + PartitionKey = 'Tenant' + RowKey = "$($tenantfilter)" + } + Add-CIPPAzDataTableEntity @Table -Entity $GraphRequest -Force + return @("We've already added our Service Principal to $($TenantName)") + } Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Could not add our Service Principal to the client tenant $($TenantName): $($_.Exception.message)" -Sev 'Error' -tenant $TenantName -tenantId $TenantFilter return @("Could not add our Service Principal to the client tenant $($TenantName): $ErrorMessage") } diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableExternalCalendarSharing.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableExternalCalendarSharing.ps1 index 92185029888a..e5e9232ed9b4 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableExternalCalendarSharing.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardDisableExternalCalendarSharing.ps1 @@ -7,7 +7,12 @@ function Invoke-CIPPStandardDisableExternalCalendarSharing { if ($Settings.remediate) { New-ExoRequest -tenantid $Tenant -cmdlet 'Get-SharingPolicy' | Where-Object { $_.Default -eq $true } | ForEach-Object { - New-ExoRequest -tenantid $Tenant -cmdlet 'Set-SharingPolicy' -cmdParams @{ Identity = $_.Id ; Enabled = $false } -UseSystemMailbox $true + try { + New-ExoRequest -tenantid $Tenant -cmdlet 'Set-SharingPolicy' -cmdParams @{ Identity = $_.Id ; Enabled = $false } -UseSystemMailbox $true + Write-LogMessage -API 'Standards' -tenant $tenant -message "Successfully disabled external calendar sharing for the policy $($_.Name)" -sev Info + } catch { + Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to disable external calendar sharing for the policy $($_.Name). Error: $($_.exception.message)" -sev Error + } } } diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardEnableCustomerLockbox.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardEnableCustomerLockbox.ps1 new file mode 100644 index 000000000000..6e259bc1bead --- /dev/null +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardEnableCustomerLockbox.ps1 @@ -0,0 +1,32 @@ +function Invoke-CIPPStandardEnableCustomerLockbox { + <# + .FUNCTIONALITY + Internal + #> + param($Tenant, $Settings) + + if ($Settings.remediate) { + try { + New-ExoRequest -tenantid $Tenant -cmdlet 'Set-OrganizationConfig' -cmdParams @{ CustomerLockboxEnabled = $true } -UseSystemMailbox $true + Write-LogMessage -API 'Standards' -tenant $tenant -message 'Successfully enabled Customer Lockbox' -sev Info + } catch { + Write-LogMessage -API 'Standards' -tenant $tenant -message "Failed to enable Customer Lockbox. Error: $($_.exception.message)" -sev Error + } + } + if ($Settings.alert -or $Settings.report) { + $CurrentInfo = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OrganizationConfig' + + if ($Settings.alert) { + if ($CurrentInfo.CustomerLockboxEnabled) { + Write-LogMessage -API 'Standards' -tenant $tenant -message 'Customer Lockbox is enabled' -sev Info + } else { + Write-LogMessage -API 'Standards' -tenant $tenant -message 'Customer Lockbox is not enabled' -sev Alert + } + } + if ($Settings.report) { + Add-CIPPBPAField -FieldName 'CustomerLockboxEnabled' -FieldValue [bool]$CurrentInfo.CustomerLockboxEnabled -StoreAs bool -Tenant $tenant + } + } + +} + diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardEnableMailboxAuditing.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardEnableMailboxAuditing.ps1 new file mode 100644 index 000000000000..477298bdcf66 --- /dev/null +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardEnableMailboxAuditing.ps1 @@ -0,0 +1,49 @@ +function Invoke-CIPPStandardEnableMailboxAuditing { + <# + .FUNCTIONALITY + Internal + #> + param($Tenant, $Settings) + + $AuditState = (New-ExoRequest -tenantid $Tenant -cmdlet 'Get-OrganizationConfig').AuditDisabled + if ( $Settings.remediate) { + if ($AuditState) { + # Enable tenant level mailbox audit + try { + New-ExoRequest -tenantid $Tenant -cmdlet 'Set-OrganizationConfig' -cmdParams @{AuditDisabled = $false } -useSystemMailbox $true + Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Tenant level mailbox audit enabled' -sev Info + } catch { + Write-LogMessage -API 'Standards' -tenant $Tenant -message "Failed to enable tenant level mailbox audit. Error: $($_.exception.message)" -sev Error + } + } else { + $LogMessage = 'Tenant level mailbox audit already enabled. ' + } + + # check for mailbox audit on all mailboxes. Enabled for all that it's not enabled for + $Mailboxes = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-Mailbox' -cmdParams @{ResultSize = 'Unlimited' } | Where-Object { $_.AuditEnabled -ne $true } + $Mailboxes | ForEach-Object { + try { + New-ExoRequest -tenantid $Tenant -cmdlet 'Set-Mailbox' -cmdParams @{Identity = $_.UserPrincipalName; AuditEnabled = $true } -Anchor $_.UserPrincipalName + Write-LogMessage -API 'Standards' -tenant $Tenant -message "User level mailbox audit enabled for $($_.UserPrincipalName)" -sev Info + } catch { + Write-LogMessage -API 'Standards' -tenant $Tenant -message "Failed to enable user level mailbox audit for $($_.UserPrincipalName). Error: $($_.exception.message)" -sev Error + } + } + if ($Mailboxes.Count -eq 0) { + $LogMessage += 'User level mailbox audit already enabled for all mailboxes' + } + Write-LogMessage -API 'Standards' -tenant $Tenant -message $LogMessage -sev Info + } + + if ($Settings.alert) { + if ($AuditState) { + Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Tenant level mailbox audit is not enabled' -sev Alert + } else { + Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Tenant level mailbox audit is enabled' -sev Info + } + } + if ($Settings.report) { + Add-CIPPBPAField -FieldName 'MailboxAuditingEnabled' -FieldValue [bool]$AuditState -StoreAs bool -Tenant $Tenant + } + +} \ No newline at end of file diff --git a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardcalDefault.ps1 b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardcalDefault.ps1 index f05a9350a705..fc4c3adb78a0 100644 --- a/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardcalDefault.ps1 +++ b/Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardcalDefault.ps1 @@ -3,63 +3,66 @@ function Invoke-CIPPStandardcalDefault { .FUNCTIONALITY Internal #> - param($Tenant, $Settings) + param($Tenant, $Settings, $QueueItem) + If ($Settings.remediate) { $Mailboxes = New-ExoRequest -tenantid $Tenant -cmdlet 'Get-Mailbox' Write-LogMessage -API 'Standards' -tenant $Tenant -message "Started setting default calendar permissions for $($Mailboxes.Count) mailboxes." -sev Info - # Thread safe counter - $UserSuccesses = [HashTable]::Synchronized(@{Counter = 0 }) - - # Set default calendar permissions for each mailbox. Run in parallel to speed up the process - $Mailboxes | ForEach-Object -ThrottleLimit 25 -Parallel { - Import-Module CIPPcore - $Tenant = $Using:Tenant - $Settings = $Using:Settings - $Mailbox = $_ - $UserSuccesses = $Using:UserSuccesses + # Retrieve the last run status + $LastRunTable = Get-CIPPTable -Table StandardsLastRun + $Filter = "RowKey eq 'calDefaults' and PartitionKey eq '{0}'" -f $tenant + $LastRun = Get-CIPPAzDataTableEntity @LastRunTable -Filter $Filter + $startIndex = 0 + if ($LastRun -and $LastRun.totalMailboxes -ne $LastRun.processedMailboxes) { + $startIndex = $LastRun.processedMailboxes + } + $SuccessCounter = if ($lastrun.currentSuccessCount) { [int64]$lastrun.currentSuccessCount } else { 0 } + $UserSuccesses = [HashTable]::Synchronized(@{Counter = $SuccessCounter }) + $processedMailboxes = $startIndex + $mailboxes = $mailboxes[$startIndex..($mailboxes.Count)] + Write-Host "CalDefaults Starting at index $startIndex" + $Mailboxes | ForEach-Object { + $Mailbox = $_ try { - $GetRetryCount = 0 - - do { - # Get all calendars for the mailbox, retry if it fails + New-ExoRequest -tenantid $Tenant -cmdlet 'Get-MailboxFolderStatistics' -cmdParams @{identity = $Mailbox.UserPrincipalName; FolderScope = 'Calendar' } -Anchor $Mailbox.UserPrincipalName | Where-Object { $_.FolderType -eq 'Calendar' } | + ForEach-Object { try { - New-ExoRequest -tenantid $Tenant -cmdlet 'Get-MailboxFolderStatistics' -cmdParams @{identity = $Mailbox.UserPrincipalName; FolderScope = 'Calendar' } -Anchor $Mailbox.UserPrincipalName | Where-Object { $_.FolderType -eq 'Calendar' } | - # Set permissions for each calendar found - ForEach-Object { - $SetRetryCount = 0 - do { - try { - New-ExoRequest -tenantid $Tenant -cmdlet 'Set-MailboxFolderPermission' -cmdparams @{Identity = "$($Mailbox.UserPrincipalName):$($_.FolderId)"; User = 'Default'; AccessRights = $Settings.permissionlevel } -Anchor $Mailbox.UserPrincipalName - Write-LogMessage -API 'Standards' -tenant $Tenant -message "Set default folder permission for $($Mailbox.UserPrincipalName):\$($_.Name) to $($Settings.permissionlevel)" -sev Debug - $Success = $true - $UserSuccesses.Counter++ - } catch { - # Retry Set-MailboxFolderStatistics - Start-Sleep -Milliseconds (Get-Random -Minimum 200 -Maximum 300) - $SetRetryCount++ - - # Log error if it fails 3 times - if ($SetRetryCount -ge 3) { - Write-LogMessage -API 'Standards' -tenant $Tenant -message "Could not set default calendar permissions for $($Mailbox.UserPrincipalName). Error: $($_.exception.message)" -sev Error - } - } - } Until ($SetRetryCount -ge 3 -or $Success -eq $true) - } - $Success = $true - } catch { - # Retry Get-MailboxFolderStatistics - Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 500) - $GetRetryCount++ - } - - } until ($GetRetryCount -ge 3 -or $Success -eq $true) - } catch { - Write-LogMessage -API 'Standards' -tenant $Tenant -message "Could not set default calendar permissions for $($Mailbox.UserPrincipalName). Error: $($_.exception.message)" -sev Error - } + New-ExoRequest -tenantid $Tenant -cmdlet 'Set-MailboxFolderPermission' -cmdparams @{Identity = "$($Mailbox.UserPrincipalName):$($_.FolderId)"; User = 'Default'; AccessRights = $Settings.permissionlevel } -Anchor $Mailbox.UserPrincipalName + Write-LogMessage -API 'Standards' -tenant $Tenant -message "Set default folder permission for $($Mailbox.UserPrincipalName):\$($_.Name) to $($Settings.permissionlevel)" -sev Debug + $UserSuccesses.Counter++ + } catch { + Write-Host "Setting cal failed: $($_.exception.message)" + Write-LogMessage -API 'Standards' -tenant $Tenant -message "Could not set default calendar permissions for $($Mailbox.UserPrincipalName). Error: $($_.exception.message)" -sev Error + } + } + } catch { + Write-LogMessage -API 'Standards' -tenant $Tenant -message "Could not set default calendar permissions for $($Mailbox.UserPrincipalName). Error: $($_.exception.message)" -sev Error + } + $processedMailboxes++ + if ($processedMailboxes % 25 -eq 0) { + $LastRun = @{ + RowKey = 'calDefaults' + PartitionKey = $Tenant + totalMailboxes = $Mailboxes.count + processedMailboxes = $processedMailboxes + currentSuccessCount = $UserSuccesses.Counter + } + Add-CIPPAzDataTableEntity @LastRunTable -Entity $LastRun -Force + Write-Host "Processed $processedMailboxes mailboxes" } - Write-LogMessage -API 'Standards' -tenant $Tenant -message "Successfully set default calendar permissions for $($UserSuccesses.Counter) out of $($Mailboxes.Count) mailboxes." -sev Info + } + $LastRun = @{ + RowKey = 'calDefaults' + PartitionKey = $Tenant + totalMailboxes = $Mailboxes.count + processedMailboxes = $processedMailboxes + currentSuccessCount = $UserSuccesses.Counter } - } \ No newline at end of file + Add-CIPPAzDataTableEntity @LastRunTable -Entity $LastRun -Force + + Write-LogMessage -API 'Standards' -tenant $Tenant -message "Successfully set default calendar permissions for $($UserSuccesses.Counter) out of $($Mailboxes.Count) mailboxes." -sev Info + } +} diff --git a/PublicWebhooks/run.ps1 b/PublicWebhooks/run.ps1 index ad13d0546ef7..124f05bd761a 100644 --- a/PublicWebhooks/run.ps1 +++ b/PublicWebhooks/run.ps1 @@ -10,22 +10,23 @@ Write-Host 'Received request' Write-Host "CIPPID: $($request.Query.CIPPID)" $url = ($request.headers.'x-ms-original-url').split('/API') | Select-Object -First 1 Write-Host $url -if ($Request.Query.CIPPID -in $Webhooks.RowKey) { +if ($Request.Query.CIPPID -in $Webhooks.RowKey -and $Webhooks.Resource -ne 'M365AuditLogs') { Write-Host 'Found matching CIPPID' - if ($Request.query.ValidationToken -or $Request.body.validationCode) { Write-Host 'Validation token received' $body = $request.query.ValidationToken } else { Push-OutputBinding -Name QueueWebhook -Value $Request $Body = 'Webhook Recieved' + $StatusCode = [HttpStatusCode]::OK } } else { $body = 'This webhook is not authorized.' + $StatusCode = [HttpStatusCode]::Forbidden } # Associate values to output bindings by calling 'Push-OutputBinding'. Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{ - StatusCode = [HttpStatusCode]::OK + StatusCode = $StatusCode Body = $body }) diff --git a/PublicWebhooksProcess/run.ps1 b/PublicWebhooksProcess/run.ps1 index 1f404c867df2..69e153f60e01 100644 --- a/PublicWebhooksProcess/run.ps1 +++ b/PublicWebhooksProcess/run.ps1 @@ -22,18 +22,53 @@ if ($Request.query.CIPPID -in $Webhooks.RowKey) { } else { # Auditlog Subscriptions - $Webhookinfo = $Webhooks | Where-Object -Property RowKey -EQ $Request.query.CIPPID - foreach ($ReceivedItem In ($Request.body)) { - $ReceivedItem = [pscustomobject]$ReceivedItem - $TenantFilter = (Get-Tenants | Where-Object -Property customerId -EQ $ReceivedItem.TenantId).defaultDomainName - Write-Host "TenantFilter: $TenantFilter" - $Data = New-GraphPostRequest -type GET -uri "https://manage.office.com/api/v1.0/$($ReceivedItem.tenantId)/activity/feed/audit/$($ReceivedItem.contentid)" -tenantid $TenantFilter -scope 'https://manage.office.com/.default' - Write-Host "Data to process found: $(($ReceivedItem.operation).count) items" - Write-Host "Operations to process for this client: $($Webhookinfo.Operations)" - foreach ($Item in $Data) { - Write-Host "Processing $($item.operation)" - Invoke-CippWebhookProcessing -TenantFilter $TenantFilter -Data $Item -CIPPPURL $url + try { + foreach ($ReceivedItem In ($Request.body)) { + $ReceivedItem = [pscustomobject]$ReceivedItem + Write-Host "Received Item: $($ReceivedItem | ConvertTo-Json -Depth 15 -Compress))" + $TenantFilter = (Get-Tenants | Where-Object -Property customerId -EQ $ReceivedItem.TenantId).defaultDomainName + Write-Host "Webhook TenantFilter: $TenantFilter" + $ConfigTable = get-cipptable -TableName 'SchedulerConfig' + $Alertconfig = Get-CIPPAzDataTableEntity @ConfigTable | Where-Object { $_.Tenant -eq $TenantFilter -or $_.Tenant -eq 'AllTenants' } + $Operations = ($AlertConfig.if | ConvertFrom-Json -ErrorAction SilentlyContinue).selection, 'UserLoggedIn' + $Webhookinfo = $Webhooks | Where-Object -Property RowKey -EQ $Request.query.CIPPID + #Increased download efficiency: only download the data we need for processing. Todo: Change this to load from table or dynamic source. + $MappingTable = [pscustomobject]@{ + 'UserLoggedIn' = 'Audit.AzureActiveDirectory' + 'Add member to role.' = 'Audit.AzureActiveDirectory' + 'Disable account.' = 'Audit.AzureActiveDirectory' + 'Update StsRefreshTokenValidFrom Timestamp.' = 'Audit.AzureActiveDirectory' + 'Enable account.' = 'Audit.AzureActiveDirectory' + 'Disable Strong Authentication.' = 'Audit.AzureActiveDirectory' + 'Reset user password.' = 'Audit.AzureActiveDirectory' + 'Add service principal.' = 'Audit.AzureActiveDirectory' + 'HostedIP' = 'Audit.AzureActiveDirectory' + 'badRepIP' = 'Audit.AzureActiveDirectory' + 'UserLoggedInFromUnknownLocation' = 'Audit.AzureActiveDirectory' + 'customfield' = 'AnyLog' + 'anyAlert' = 'AnyLog' + 'New-InboxRule' = 'Audit.Exchange' + 'Set-InboxRule' = 'Audit.Exchange' + } + #Compare $Operations to $MappingTable. If there is a match, we make a new variable called $LogsToDownload + #Example: $Operations = 'UserLoggedIn', 'Set-InboxRule' makes : $LogsToDownload = @('Audit.AzureActiveDirectory',Audit.Exchange) + $LogsToDownload = $Operations | Where-Object { $MappingTable.$_ } | ForEach-Object { $MappingTable.$_ } + if ($ReceivedItem.ContentType -in $LogsToDownload -or $LogsToDownload -contains 'AnyLog') { + $Data = New-GraphPostRequest -type GET -uri "https://manage.office.com/api/v1.0/$($ReceivedItem.tenantId)/activity/feed/audit/$($ReceivedItem.contentid)" -tenantid $TenantFilter -scope 'https://manage.office.com/.default' + } else { + Write-Host "No data to download for $($ReceivedItem.ContentType)" + continue + } + Write-Host "Data found: $($data.count) items" + $DataToProcess = $Data | Where-Object -Property Operation -In $Operations + Write-Host "Data to process found: $($DataToProcess.count) items" + foreach ($Item in $DataToProcess) { + Write-Host "Processing $($item.operation)" + Invoke-CippWebhookProcessing -TenantFilter $TenantFilter -Data $Item -CIPPPURL $url + } } + } catch { + Write-Host "Webhook Failed: $($_.Exception.Message)" } } diff --git a/Scheduler_Timer/function.json b/Scheduler_Timer/function.json index 1d19ac7d6733..56e4cf0cfda1 100644 --- a/Scheduler_Timer/function.json +++ b/Scheduler_Timer/function.json @@ -2,7 +2,7 @@ "bindings": [ { "name": "Timer", - "schedule": "0 */20 * * * *", + "schedule": "0 0 * * * *", "direction": "in", "type": "timerTrigger" }, diff --git a/host.json b/host.json index ee3245a61b88..00c49cbf2490 100644 --- a/host.json +++ b/host.json @@ -6,13 +6,14 @@ "functionTimeout": "00:10:00", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[2.*, 3.0.0)" + "version": "[4.*, 5.0.0)" }, "extensions": { "queues": { - "maxDequeueCount": 5 - }}, + "maxDequeueCount": 3 + } + }, "logging": { "fileLoggingMode": "never" - } + } } diff --git a/profile.ps1 b/profile.ps1 index f30159db12cb..f0507dec3db2 100644 --- a/profile.ps1 +++ b/profile.ps1 @@ -13,7 +13,7 @@ # Remove this if you are not planning on using MSI or Azure PowerShell. # Import modules -@('CippCore', 'CippExtensions', 'Az.KeyVault', 'Az.Accounts') | ForEach-Object { +@('CippCore', 'CippExtensions', 'Az.KeyVault', 'Az.Accounts', 'AzureFunctions.PowerShell.Durable.SDK') | ForEach-Object { try { Import-Module -Name $_ -ErrorAction Stop } catch { diff --git a/version_latest.txt b/version_latest.txt index e94f14fa9ed3..efd4ffcab8d6 100644 --- a/version_latest.txt +++ b/version_latest.txt @@ -1 +1 @@ -4.9.3 \ No newline at end of file +4.9.5 \ No newline at end of file