Skip to content

Commit

Permalink
Resolves #501 (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adee1499 authored Feb 9, 2024
1 parent 07efcfa commit 710594b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1016,20 +1016,14 @@ function Update-BasicSQLDataSourceCredentials{
[parameter(Mandatory = $true)]$ReportName,
[Parameter(Mandatory=$true)]$Username,
[Parameter(Mandatory=$true)]$Password,
[Parameter(Mandatory=$true)]$Individual
[Parameter(Mandatory=$true)]$Scope
)

$GroupPath = Get-PowerBIGroupPath -WorkspaceName $WorkspaceName -Create $false
$report = Get-PowerBIReport -GroupPath $GroupPath -ReportName $ReportName -Verbose

$datasources = Get-PowerBiDataSetDataSources -GroupPath $GroupPath -DataSetId $report.DatasetId

if($Individual){
$level = "Individual"
}else {
$level = "Organizational"
}

foreach ($dataSource in $datasources) {

#Store the data source id in a variable (for ease of use later)
Expand All @@ -1049,7 +1043,7 @@ function Update-BasicSQLDataSourceCredentials{
"credentials": "{\"credentialData\":[{\"name\":\"username\", \"value\":\"$($FormattedDataSourceUser)\"},{\"name\":\"password\", \"value\":\"$($FormattedDataSourcePassword)\"}]}",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "None",
"privacyLevel": "$($level)"
"privacyLevel": "$($Scope)"
}
}
"@
Expand Down
10 changes: 3 additions & 7 deletions azuredevops/powerbiactions-new/powerbiactionsnew/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PROCESS {
$datasourceType = Get-VstsInput -Name DatasourceType
$updateAll = Get-VstsInput -Name UpdateAll -AsBool
$skipReport = Get-VstsInput -Name SkipReport -AsBool
$individualString = Get-VstsInput -Name Individual
$scope = Get-VstsInput -Name Scope
$servicePrincipalString = Get-VstsInput -Name ServicePrincipals
$connectionString = Get-VstsInput -Name ConnectionString
$ParameterInput = Get-VstsInput -Name ParameterInput
Expand All @@ -94,11 +94,7 @@ PROCESS {
$datasetPermissionsGroupObjectIds = Get-VstsInput -Name DatasetPermissionsGroupObjectIds
$datasetAccessRight = Get-VstsInput -Name DatasetAccessRight

$individual = $false
if($individualString -eq "Individual"){
$individual = $true
}


Write-Debug "WorkspaceName : $($workspaceName)";
Write-Debug "Create : $($Create)";

Expand Down Expand Up @@ -186,7 +182,7 @@ PROCESS {
Update-ConnectionStringDirectQuery -WorkspaceName $workspaceName -DatasetName $dataset -ConnectionString $connectionstring
}
elseif($action -eq "UpdateSqlCreds"){
Update-BasicSQLDataSourceCredentials -WorkspaceName $workspaceName -ReportName $ReportName -Username $userName -Password $password -Individual $individual
Update-BasicSQLDataSourceCredentials -WorkspaceName $workspaceName -ReportName $ReportName -Username $userName -Password $password -Scope $scope
}
elseif ($action -eq "UpdateParameters") {
Write-Debug "Dataset : $($dataset)";
Expand Down
10 changes: 6 additions & 4 deletions azuredevops/powerbiactions-new/powerbiactionsnew/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,15 @@
"name": "Scope",
"type": "picklist",
"label": "Scope",
"defaultValue": "Individual",
"defaultValue": "Private",
"required": true,
"helpMarkDown": "Individual is used to access entities that belong to the current user. Organization is used to access entities across the entire company. Only Power BI tenant admins are allowed to use.",
"helpMarkDown": "Data sources set to Private contain sensitive or confidential information. Visibility can be restricted to authorized users. Data from a private data source won't fold in to other data sources, including other private data sources. Data sources set to Organizational can fold in to private and other organizational data sources. They can't fold in to public data sources. Visibility is set to a trusted group. Files, internet data sources, and workbook data can be set to Public. Data can fold in to other data sources. Visibility is available to everyone.",
"visibleRule": "Action = UpdateSqlCreds",
"options": {
"Individual": "Individual",
"Organization": "Organization"
"Public": "Public",
"Organizational": "Organizational",
"Private": "Private",
"None": "None"
}
},
{
Expand Down

0 comments on commit 710594b

Please sign in to comment.