Runbook only runs for 3 hours then throws: The process cannot access the file Microsoft.ApplicationInsights.dll' because it is being used by another process.

This page summarizes the projects mentioned and recommended in the original post on /r/AZURE

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • powershell

    PnP PowerShell (by pnp)

  • # Use system-assigned managed identity # https://mmsharepoint.wordpress.com/2023/05/04/authentication-in-azure-automation-with-managed-identity-on-sharepoint-and-microsoft-graph/ # https://pnp.github.io/powershell/articles/azureautomationrunbook.html # Connect to multiple sites # https://github.com/pnp/powershell/issues/1748 # https://robdy.io/multiple-pnp-connections/ # Prod $SourceStr = Get-AutomationVariable -Name 'SharePointSourceFolders' $Target = Get-AutomationVariable -Name 'SharePointTargetFolder' #$SourceList = $SourceStr.Split([System.Environment]::NewLine,[System.StringSplitOptions]::RemoveEmptyEntries) $SourceList = $SourceStr.Split("\n") # Commmon Foreach($Source in $SourceList){ Try{ Write-Output "Source Folder: $Source" #Dev #$SourceSiteConnection = Connect-PnPOnline -Url $SourceSiteURL -Interactive -ReturnConnection #Prod $SourceSiteConnection = Connect-PnPOnline -Url $SourceSiteURL -ManagedIdentity -ReturnConnection #Get the total Size of the folder - with versions $SourceFolder = Get-PnPFolder -Url $Source -Includes ListItemAllFields -Connection $SourceSiteConnection $SourceFolderSize = $([Math]::Round(($SourceFolder.ListItemAllFields.FieldValues.SMTotalSize.LookupId/1KB),2)) Write-Output "Source Folder Size: $Source : $SourceFolderSize" $job = Move-PnPFile -SourceUrl $Source -TargetUrl $Target -NoWait -Overwrite -AllowSchemaMismatch -AllowSmallerVersionLimitOnDestination -Force -Connection $SourceSiteConnection $jobStatus = Receive-PnPCopyMoveJobStatus -Job $job -Wait -Connection $SourceSiteConnection if($jobStatus.JobState -eq 0){ Write-Output "Job finished" $jobStatus.JobState $jobStatus.Logs $SourceFolder = Get-PnPFolder -Url $Source -Includes ListItemAllFields -Connection $SourceSiteConnection -ErrorAction SilentlyContinue if($SourceFolder){ Write-Output "Second Try because folder: $SourceFolder.Name remains" $SourceFolderSize = $([Math]::Round(($SourceFolder.ListItemAllFields.FieldValues.SMTotalSize.LookupId/1KB),2)) Write-Output "Second Try Source Folder Size: $Source : $SourceFolderSize" $job = Move-PnPFile -SourceUrl $Source -TargetUrl $Target -NoWait -Overwrite -AllowSchemaMismatch -AllowSmallerVersionLimitOnDestination -Force -Connection $SourceSiteConnection $jobStatus = Receive-PnPCopyMoveJobStatus -Job $job -Wait -Connection $SourceSiteConnection if($jobStatus.JobState -eq 0){ Write-Output "Second TryJob finished" $jobStatus.JobState $jobStatus.Logs } else{ Write-Error "Second Try Status: $jobStatus" } } } else{ Write-Error "$jobStatus" } } catch { Write-Error "An error occurred: ${Source}: $_" } # Dispose the connnection variables $SourceSiteConnection = $null Write-Output "Sleep for 2 seconds" Start-Sleep -Milliseconds 2000 }

  • azure-docs

    Open source documentation of Microsoft Azure

  • Official doc on runbook limitations: https://github.com/MicrosoftDocs/azure-docs/blob/main/includes/azure-automation-service-limits.md

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts