Forum Discussion

xantari's avatar
xantari
Icon for Helper II rankHelper II
8 years ago

Scheduled Refresh notifications (On-Premise)

We can not find a way to get Refresh Notification failure emails when a scheduled data refresh occurs on-premise.

 

Apparently this has existed for a long time on Power BI (because they have to deal with a lot more data connectivity issues with the gateway service I am guessing).

 

Where is this function in the on-premise version? As it is important on-premise as it is on cloud service.

12 Replies

  • This is my solution as second step in SQL Agent. Preliminarily you should configure MS SQL MAIL and find out GUID of your Catalog.ItemID = '????'. This step sends notification by mail after successfully refreash data (1 step) to all users of this report

     

    DECLARE	
    	@xml  XML,
    	@str varchar(8000) = ''
    SELECT @xml = CAST(XmlDescription as XML)
    FROM Catalog WITH (NOLOCK)
    INNER JOIN Policies WITH (NOLOCK) ON Catalog.PolicyID = Policies.PolicyID
    LEFT OUTER JOIN SecData WITH (NOLOCK) ON Policies.PolicyID = SecData.PolicyID AND AuthType = 1
    WHERE Catalog.ItemID = 'E3280AC8-EFF4-4AF6-8ED3-583C6112139A' 
    AND PolicyFlag = 0
    declare
    	@t table (mail_to varchar(100))
    SET QUOTED_IDENTIFIER ON;
    insert 
    	@t
    SELECT	xmlData.A.value('.', 'VARCHAR(100)') AS mail
    FROM	@xml.nodes('Policies/Policy/GroupUserName') xmlData(A)
    delete @t
    where mail_to = 'BUILTIN\Administrators'
    update @t
    set mail_to = REPLACE(REPLACE(mail_to, 'KCELL.KZ\',''), '@kcell.kz','') + '@kcell.kz'
    
    SELECT @str = @str + ISNULL(t.mail_to + ';', '') FROM @t t
    
    SET @str = SUBSTRING(@str, 1, LEN(@str) - 1)
    
    WAITFOR DELAY '00:10:00'; 
    
    DECLARE @body NVARCHAR(MAX)
    SET @body = '
    <html>
    	<body>
    		<H2>Daily RSSS-OU-CCHT statistics</H2>
    		<H3>Data were updated successfully!</H3>
    		<p><a href="http://192.168.223.13/Reports/powerbi/CCD%20reports/Daily%20RSSS-OU-CCHT%20statistics">Open report</a></p>
    	</body>
    </html>'
    
    EXEC msdb.dbo.sp_send_dbmail  
        @profile_name = 'power_bi_report_server',
        @recipients = @str,
        @copy_recipients = '[email protected]',
        @body = @body,
        @subject = 'Power BI Report Server Alert',
        @body_format = 'HTML';

     

     

     

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    In Power BI report Server, every schedule you create goes to SQL Server Agent JOB, so you can go to the SQL Server Agent JOB and then you can add one more step after the current step for sending the email. You might need to configure email in SQL in order to send the email through JOB.

    • xantari's avatar
      xantari
      Icon for Helper II rankHelper II

      WHich one of the 150 SQL Agent jobs do I do that on. They are just labeled as a GUID.

       

      This doesn't seem like a good solution.

       

      Microsoft needs to fix this if there is no other way. Why don't they just add a task at the end of these SQL Agent jobs for the server administrator if it is setup in the Power BI Server backend? 

       

      Seems like basic functionality is missing here.

      • xantari's avatar
        xantari
        Icon for Helper II rankHelper II

        FYI, I found the SQL AGent job (labeled as GUID 87B024E7-A122-4DE9-818A-8016826EB9E3) in SQL Agent.

         

        It shows as successful this morning. But the data refresh shows error on Power BI front end.

         

        So it appears SQL Agent failures do NOT occur when the data refresh fails.