Who/what unpaused my Azure SQL Database?

Tautvydas Perminas 1 Reputation point
2022-05-25T11:47:44.613+00:00

Looking at App CPU Billed measure I see that my Azure SQL database is sometime billed during non-working hours. I have set Pause to 1 hour, and there are no scheduled activity in non-working hours. However, I constantly see App CPU Billed when the database is supposed to be "sleeping". There are no queries running at that time as per screenshots.
So my question is how do I find out what/who unpauses my database?

205495-no-queries.jpg205456-billing.jpg

Azure SQL Database
Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,035 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Alberto Morillo 32,886 Reputation points MVP
    2022-05-25T12:52:00.767+00:00

    Please examine Azure Defender for SQL as it runs periodic scans including vulnerability scans and the threat detection feature also can create activity. Those are usually the culprit in my experience.

    Other possible conditions that can trigger auto-resume are explained here.

    0 comments No comments

  2. Tautvydas Perminas 1 Reputation point
    2022-05-25T13:05:58.247+00:00

    Azure Defender for SQL and Automatic Tuning are disabled for this database.


  3. Oury Ba-MSFT 16,156 Reputation points Microsoft Employee
    2022-06-02T19:37:44.933+00:00

    Hi @Tautvydas Perminas Thank you for posting your query on Microsoft Q&A and for using Azure services.
    My understanding is that you are seeing App CPU billed even though database was paused.

    **How do I find out what/who unpauses my database? **

    The following features do not support auto-pausing but do support auto-scaling. If any of the following features are used, then auto-pausing must be disabled, and the database will remain online regardless of the duration of database inactivity:

    Auto-pausing is temporarily prevented during the deployment of some service updates which require the database be online. In such cases, auto-pausing becomes allowed again once the service update completes.

    Auto-pause troubleshooting
    If auto-pausing is enabled, but a database does not auto-pause after the delay period, and the features listed above are not used, the application or user sessions may be preventing auto-pausing. To see if there are any application or user sessions currently connected to the database, connect to the database using any client tool, and execute the following query:

    SELECT session_id,
    host_name,
    program_name,
    client_interface_name,
    login_name,
    status,
    login_time,
    last_request_start_time,
    last_request_end_time
    FROM sys.dm_exec_sessions AS s
    INNER JOIN sys.dm_resource_governor_workload_groups AS wg
    ON s.group_id = wg.group_id
    WHERE s.session_id <> @@SPID
    AND
    (
    (
    wg.name like 'UserPrimaryGroup.DB%'
    AND
    TRY_CAST(RIGHT(wg.name, LEN(wg.name) - LEN('UserPrimaryGroup.DB') - 2) AS int) = DB_ID()
    )
    OR
    wg.name = 'DACGroup'
    );

    Source: Azure SQL Database serverless

    Regards,
    Oury