Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Install-Module PowerBIPS
Import-Module PowerBIPS -Force
# PowerBI Username
$username = "user@customer.com.au"
# Password for PowerBI User
$password = "ssssh1t'sS3cr3T!" | convertto-securestring -AsPlainText -Force
# Client ID from the PowerBI Client App created as the pre-req's
$clientID = "71b5f022-0800-1234-good-beerbeer"
$credentials = New-Object System.Management.Automation.PSCredential $Username,$password
$authToken = Get-PBIAuthToken -clientId $clientID -Credential $credentials
# Look to see if our DataSet Exists
$dataSetIOTMetadata = Get-PBIDataSet -authToken $authToken -name "Environmental Sensors"
$dataSetIOTSchema = @{
name = "Environmental Sensors"
; tables = @(
@{name = "Outside"
; columns = @(
@{ name = "DateTime"; dataType = "DateTime" }
, @{ name = "Temperature"; dataType = "Integer" }
, @{ name = "Light"; dataType = "Integer" }
, @{ name = "AirQuality"; dataType = "Integer" }
)}
@{name = "Inside"
; columns = @(
@{ name = "DateTime"; dataType = "DateTime" }
, @{ name = "Temperature"; dataType = "Integer" }
, @{ name = "Light"; dataType = "Integer" }
, @{ name = "AirQuality"; dataType = "Integer" }
)}
)
; relationships = @(
@{name = "DT"}
, @{crossFilteringBehavior = "OneDirection"}
, @{fromTable = "Inside"}
, @{fromColumn = "DateTime"}
, @{toTable = "Outside"}
, @{toColumn = "DateTime"})
}
$dataSetIOTMetadata = New-PBIDataSet -authToken $authToken -dataSet $dataSetIOTSchema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.