Friday, October 23, 2020

In Power BI dataset, you could use PowerShell to refresh the dataset. Here is the sample script to refresh Here is the script to refresh dataset named “MyReport” inside workspace named “My Workspace”.  

$User = "admin@mycompany.com"

$PW = "password"

$SecPasswd = ConvertTo-SecureString $PW -AsPlainText -Force

$myCred = New-Object System.Management.Automation.PSCredential($User,$SecPasswd)

Connect-PowerBIServiceAccount -Credential $myCred


# Get Power BI Workspace ID

$WSID = Get-PowerBIWorkspace  -Scope Organization -Name 'My Workspace'| ForEach {$_.Id}


# Get dataset ID

$DSIDRefresh = Get-PowerBIDataset -Scope Organization -WorkspaceId $WSIDAdmin | Where {$_.Name -eq "MyReport"} | ForEach {$_.Id}


$RefreshDSURL = 'groups/' + $WSIDAdmin + '/datasets/' + $DSIDRefresh + '/refreshes'

$MailFailureNotify = @{"notifyOption"="MailOnFailure"}

Invoke-PowerBIRestMethod -Url $RefreshDSURL -Method Post -Body $MailFailureNotify

Please note after refresh done from PowerShell, if you look at the refresh history, you will see the refresh  type is empty. It seems like Power BI could not decide if the refresh is done by on demand or Scheduled.



10 comments:

  1. Much obliged for such an extraordinary post and the audit, I am completely intrigued! Keep stuff like this coming.
    360DigiTMG Artificial intelligence Malaysia

    ReplyDelete
  2. You are honest and always admit when you don’t have the knowledge about something i need.
    https://360digitmg.com/course/data-analytics-using-python-r

    ReplyDelete
  3. I am so grateful for your article.Really thank you! Really Cool.
    power bi training
    power bi course

    ReplyDelete
  4. Appreciative. The best decision that you can make is to hire app makers near me. There are several benefits of hiring them but the question arises from where Eiliana.com is a global freelancing portal where you hire the best freelancers by filtering the location whichever suits your needs. Not all freelancing portals serve you with this unique feature but Eiliana does.

    ReplyDelete
  5. Thank you for sharing this wonderful article. I use a lot of these strategies and procedures myself. Personally, I prefer to concentrate on backlinks from safe websites.
    we are sharing Buygenmeds
    Vidalista is a prescription medicine used to treat impotence, also known as erectile dysfunction, in males (ED). Fildena is more effective and so sells more.

    ReplyDelete
  6. Superb Post.
    If you feel sleepy in office then you can try Armodafinil to stay active.
    armodafinil for sale

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Thanks for sharing this informative article on how to use PowerShell to refresh the dataset. If you have any requirement to Hire PowerBI Developers for your project. Please visit us.

    ReplyDelete
  9. Infraroodverwarming wordt per zone aangestuurd waardoor je op een (kosten) efficiƫnte manier de temperatuur per vertrek kunt regelen. Infraroodverwarming is flexibel omdat je naast het zonegericht regelen van het klimaat in huis ook kunt werken met infrarood panelen, ideaal om bijvoorbeeld om overdag alleen de werkkamer te verwarmen.
    You can visit website Redwell Infrarood

    ReplyDelete
  10. Saliva testing is a testing process that involves checking saliva for drugs and alcohol. This test can be completed in our lab or specimen collection site using a mouth swab, cotton swab, swab stick, spitting, draining of using suction.
    You can visit website: Saliva Test in GTA

    ReplyDelete