Online sharepoint: Message error when retrieving a SPOnline site after creating it with PowerShell

I'm implementing some Shell Power Scripts to help my team create new ones. SharePoint Online sites One of these scripts follows these requirements:

  • be able to create a site,
  • be able to eliminate the site if it exists previously,
  • be able to return the created site

It seems to be easy to use the SharePoint Online Management Shell and that's it, but I'm facing a problem that produces the following error:

Get-SPOSite: error in proc_GetSitesAllowDenyList, no rowset is returned.

I get it sometimes, not always, but I do not know why and I can not find any explanation about it in Google. Let me share my code and try to explain it:

                # Get the site if it exists
$ Instance = Get-SPOSite $ Url

# Remove the site if it exists and the user requires it.
Yes ($ null -ne $ Instance -y $ true -eq $ RemoveIfExists) {
Write-Host "Deleting site" $ Url "..."

Remove-SPOSite $ Url -Confirm: $ false
Remove-SPODeletedSite $ Url -Confirm: $ false

$ Instance = $ null

# Create the site if it does not exist
Yes ($ null -eq $ Instance) {
Write-Host "Creating site" $ Url "..."
$ Instance = New-SPOSite-Owner $ Owner -Url $ Url -Title $ Title -StorageMota $ Fee -Template $ Template

# Return the site
Get-SPOSite $ Url

As I said, it seems that everything works perfectly fine, but when you reach the last line the error occurs. Do you think I need to add some delay to leave SharePoint / Office 365 Complete all the things you need before recovering the site?