Skip to content

Install-Azure.sql: sp_Blitz fails to create on Azure SQL Database (Msg 40515) #4040

Description

@richardCronwright

Version of the script: sp_Blitz v8.34, version date 2026-07-02 (current at time of report — the 2026-04-07 release does not exhibit this bug, so it's a regression introduced between those two releases).

What is the current behavior?
Running Install-Azure.sql fails partway through the sp_Blitz batch:

Msg 40515, Level 15, State 1, Procedure sp_Blitz
Reference to database and/or server name in 'model.sys.objects' is not supported in this version of SQL Server.

sp_Blitz is not created (the batch aborts). All other procedures in the installer (sp_ineachdb, sp_BlitzAnalysis, sp_BlitzCache, sp_BlitzIndex, sp_BlitzLock, sp_BlitzWho, sp_BlitzFirst) create successfully.

Steps to reproduce:

Download the 2026-07-02 (v8.34) First Responder Kit.
Run Install-Azure.sql against a single Azure SQL Database (EngineEdition 5).
Observe Msg 40515 on the sp_Blitz batch; sp_Blitz object is never created.

The sp_Blitz batch contains static (non-dynamic-SQL) three-part references to model, msdb, master, and tempdb (e.g. model.sys.objects, msdb.dbo.backupset, msdb.dbo.sysjobs, tempdb.sys.database_files) inside IF/EXISTS checks. These are presumably meant to be skipped at runtime on Azure, but Azure SQL DB rejects cross-database names at module compile/creation time, so the CREATE/ALTER fails before the runtime guard ever runs.

What is the expected behavior?
Install-Azure.sql should create sp_Blitz successfully on a single Azure SQL Database, with the non-applicable msdb/master/model/tempdb-dependent checks skipped (as the runtime @Skip* variables appear intended to do), consistent with the "only installs the scripts that are compatible with Azure SQL DB" description of that installer.

Which versions of SQL Server and which OS are affected? Did this work in previous versions?
Azure SQL Database (single database), EngineEdition 5. OS not applicable (managed PaaS). Confirmed working in the 2026-04-07 release against the same database with no errors; the failure is present in the 2026-07-02 (v8.34) release, so it's a regression introduced in that window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions