An Azure service that provides an event-driven serverless compute platform.
Her is my requirements.psd1
# This file enables modules to be automatically managed by the Functions service.
# See https://aka.ms/functionsmanageddependency for additional information.
#
@{
# For latest supported version, go to 'https://www.powershellgallery.com/packages/Az'.
# To use the Az module in your function app, please uncomment the line below.
'Az' = '9.*'
}
Here is my profile.pds1
Azure Functions profile.ps1
#
# This profile.ps1 will get executed every "cold start" of your Function App.
# "cold start" occurs when:
#
# * A Function App starts up for the very first time
# * A Function App starts up after being de-allocated due to inactivity
#
# You can define helper functions, run commands, or specify environment variables
# NOTE: any variables defined that are not environment variables will get reset after the first execution
# Authenticate with Azure PowerShell using MSI.
# Remove this if you are not planning on using MSI or Azure PowerShell.
if ($env:MSI_SECRET) {
Disable-AzContextAutosave -Scope Process | Out-Null
Connect-AzAccount -Identity
}
# Uncomment the next line to enable legacy AzureRm alias in Azure PowerShell.
# Enable-AzureRmAlias
# You can also define functions or aliases that can be referenced in any of your PowerShell functions.
Here is my error message
2024-05-24T12:57:31Z [Error] ERROR: Object reference not set to an instance of an object. Exception : Type : System.NullReferenceException TargetSite : Name : GetEntity DeclaringType : Microsoft.Azure.Commands.Sql.ManagedDatabase.Cmdlet.RestoreAzureRmSqlManagedDatabase MemberType : Method Module : Microsoft.Azure.PowerShell.Cmdlets.Sql.dll Message : Object reference not set to an instance of an object. Source : Microsoft.Azure.PowerShell.Cmdlets.Sql HResult : -2147467261 StackTrace : at Microsoft.Azure.Commands.Sql.ManagedDatabase.Cmdlet.RestoreAzureRmSqlManagedDatabase.GetEntity() at Microsoft.Azure.Commands.Sql.Common.AzureSqlCmdletBase`2.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.<>c__3`1.<ExecuteSynchronouslyOrAsJob>b__3_0(T c) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet, Action`1 executor) at Microsoft.WindowsAzure.Commands.Utilities.Common.CmdletExtensions.ExecuteSynchronouslyOrAsJob[T](T cmdlet) at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() CategoryInfo : CloseError: (:) [Restore-AzSqlInstanceDatabase], NullReferenceException FullyQualifiedErrorId : Microsoft.Azure.Commands.Sql.ManagedDatabase.Cmdlet.RestoreAzureRmSqlManagedDatabase InvocationInfo : MyCommand : Restore-AzSqlInstanceDatabase ScriptLineNumber : 26 OffsetInLine : 1 HistoryId : 1 ScriptName : C:\home\site\wwwroot\Aspen_RO_Copy\run.ps1 Line : Restore-AzSqlInstanceDatabase -FromPointInTimeBackup -ResourceGroupName $resourceGroup -InstanceName $managedInstance -Name $database -PointInTime $pointInTime -TargetInstanceDatabaseName $targetDatabase ` PositionMessage : At C:\home\site\wwwroot\Aspen_RO_Copy\run.ps1:26 char:1