Forum Discussion
Script to create data sources
Hi all,
I am trying to script the creation of data sources as we are doing a tenant migration.
I have some questions about the following MS scripts but first some background into my environment...
My on-premises gateway was setup using a recovery key (as per https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/EncryptGatewayCredentials.ps1)
My connections are all SQL with a service principal as the auth
Script 1:
- I should remove the sections basic credentialks, windows credentials, anonymous credentials & Oauth credentials and just leave key credentials?
- under the param section, there is a variable for $Key - does that need to be specified somewhere?
- Is the key value the same as the recovery key?
I added in a variable
$Key = "xxxxxxxxxxxxxxxxx"And when running the script i get no errors
Script 2:
- I am fine to enter the details datasource name, datasource type, gateway id, secret, app id, tenant id but for username and password what do i enter as mentioned i am using a service principal?
- Under $encryptedCredentials = EncryptKeyCredentials what would this string look like in my case?
When running the script I am getting errors like
The term 'EncryptWindowsCredentials' is not recognized as a name of a cmdlet, function, script
I changed it to $encryptedCredentials = EncryptKeyCredentials but then all sorts of errors
Is someone able to point me in the right direction?
Thanks,
David
5 Replies
- lbendlinSuper User
great questions. Make sure to be precise when you say "connections" - you seem to be working on gateway connections, not semantic model connections.
The recovery key has nothing to do with connections, it is only needed when you add or modify gateway cluster members.
You are saying all your SQL sources use Service Principals for authentication> Where are you migrating to?
- daiveRegular Visitor
lbendlin ,
My goal is to create managed connections. We are busy with a tenant migration (consolidation of multiple tenants into one).
According to script 2 i need to run script 1 first so that is why I am referencing data gateways. But my goal.is to create the managed connections which use the gateway to connect to data. In my case all connections are sql based. The MS documentation on creating datasources seems light on info so these scripts looked great but I am unable to get a result, likely either me misunderstanding the requirements or formatting the body of the REST call.
So looking for some help forming the script to achieve my goal
- lbendlinSuper User
Personal, biased, subjective opinion: Don't waste your time. Set up the connections from scratch in the new environment. The entire connections API is half baked and very temperamental. A true time sink.