Trying to use this script in the Function App and I am getting an error The Function app may be missing a module containing the 'New-AzStorageContext' command definition. If this command belongs to a module available on the PowerShell Gallery, add a reference to this module to requirements.psd1.
This script works in my PowerShell no problem
$CleanupTime = [DateTime]::UtcNow.AddHours(-1440)
$context = New-AzStorageContext -StorageAccountName masteryeducation1433 -StorageAccountKey "mykey"
Get-AzStorageBlob -Container "sql-db-full-backups-mul" -Context $context |
Where-Object { $.LastModified.UtcDateTime -lt $CleanupTime -and $.BlobType -eq "PageBlob" -and $_.Name -like "*.bak"} |
Remove-AzStorageBlob
my requirements.psd1
@{
# 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' = '6.*'
}