Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code fails if allowNativeQueries=true #1

Closed
anncrawford01 opened this issue Jun 9, 2020 · 0 comments
Closed

Code fails if allowNativeQueries=true #1

anncrawford01 opened this issue Jun 9, 2020 · 0 comments

Comments

@anncrawford01
Copy link
Contributor

I love this code. Thank you. It will fail if the data flow accesses native sql queries.

I updated function _getPowerBIDataflowDefinition
with this
if ($flowdefinition.'pbi:mashup'.'allowNativeQueries')
{
$flowdefinition.'pbi:mashup'.'allowNativeQueries'= $FALSE
}

== here is the code snippet

function getPowerBIDataflowDefinition([string] $GroupID, [string]$DataflowName) {
$url = [string]::Format("groups/{0}/dataflows", $GroupID);
$flowItems = Invoke-PowerBIRestMethod -Method GET -Url $url | ConvertFrom-Json
$flow = $flowItems.value | Where-Object { $
.name -eq $DataflowName }

if ($flow) {
    $url = [string]::Format("groups/{0}/dataflows/{1}", $GroupID, $flow.objectId);
    $flowdefinition = Invoke-PowerBIRestMethod -Method GET -Url $url | ConvertFrom-Json

    # check for allowNativeQueries
    #    "pbi:mashup": {
    #    "allowNativeQueries": false,
    if ($flowdefinition.'pbi:mashup'.'allowNativeQueries')
    {
        $flowdefinition.'pbi:mashup'.'allowNativeQueries'= $FALSE
    }
anncrawford01 pushed a commit to anncrawford01/Power-BI-Automation that referenced this issue Jun 9, 2020
marclelijveld added a commit that referenced this issue Jun 16, 2020
#1 fix for allowNativeQueries = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants