1

Basically we want to store backups on Azure Blob storage, yet Invoke-DbaDbLogShipping requires a $BackupNetworkPath. The closest I was to this was Azure File Shares but unfortunately port 445 is blocked it seems so I can't utilize that.

I'm now trying to modify the Invoke-DbaDbLogShipping function to replace the mandatory $BackupNetworkPath with Azure Blob Storage upload backups logic but I'm running into some issues:

Write-Message : The term 'Write-Message' is not recognized as the name of a cmdlet, function, script file, or operable program.
Test-FunctionInterrupt : The term 'Test-FunctionInterrupt' is not recognized as the name of a cmdlet, function, script file, or operable program.
Stop-Function : The term 'Stop-Function' is not recognized as the name of a cmdlet, function, script file, or operable program.
The property 'StatementTimeout' cannot be found on this object. Verify that the property exists and can be set.

To circumvent these errors, I copied/pasted the functions from the dbatools internal helper functions:

Write-Message

Stop-Function

but I ran into yet another issue with [Sqlcollaborative.Dbatools.dbaSystem...]

For example: Unable to find type [Sqlcollaborative.Dbatools.dbaSystem.MessageLevel].

I tried importing the module Import-Module dbatools in the script before the Invoke-DbaDbLogShipping and that didn't help.

halfer
  • 19,824
  • 17
  • 99
  • 186
Cataster
  • 3,081
  • 5
  • 32
  • 79
  • "Im now trying to modify the Invoke-DbaDbLogShipping function" - by modifying the containing module file (`allcommands.ps1`) in place, or by copying the function definition elsewhere and modifying it? – Mathias R. Jessen Sep 07 '21 at 08:57
  • @MathiasR.Jessen by copying the function definition elsewhere and modifying it. Wait where's the allcommands.ps1? Does it contain all dbatools functions which would resolve the problems including assembly references? – Cataster Sep 07 '21 at 13:26
  • When you copy it somewhere else, it'll no longer inherit it's _scope_ from the `dbatools` module and you'll no longer be able to resolve any private scoped functions belonging to the module. You'll want to edit the function definition _in place_ instead. Although the best option is probably to open an issue [on GitHub](https://github.com/sqlcollaborative/dbatools/issues) and request this feature - the dbatools community is usually pretty responsive :-) – Mathias R. Jessen Sep 07 '21 at 13:30
  • @MathiasR.Jessen oh I see, makes sense. Where do I edit it in place? Is it the allcommands.ps1 file? Can you link it to me please? Also I did consider posting a feature request but we have to deliver a log shipping solution in like 2 weeks, which I dont think will be enough time for the community to resolve – Cataster Sep 07 '21 at 13:48
  • If I install the latest version of `dbatools` from the gallery, the file is in the root folder, you should be able to resolve the path with `Get-Module -ListAvailable dbatools |Split-Path -LiteralPath {$_.Path} |Join-Path -ChildPath allcommands.ps1` – Mathias R. Jessen Sep 07 '21 at 14:17

0 Answers0