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

I'd like to record a Macro and then run this via the command line to support a scheduled task. Does anyone know if this is possible? I am on version 3.7.1 but can update to the latest build if required. #943

Closed
MikkyD2 opened this issue Jul 12, 2023 · 6 comments

Comments

@MikkyD2
Copy link

MikkyD2 commented Jul 12, 2023

Describe the issue
A clear and concise description of what the issue is.

** Which version are you currently using? **
Tabular Editor 3, version: [Help -> About will show you]
Tabular Editor 3 edition: [Trial/Desktop/Business/Enterprise]

To Reproduce
Are you connected to SSAS/AAS/Power BI or working offline?

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Windows version: [e.g. 10/11]

Additional context
Add any other context about the problem here.

@MikkyD2 MikkyD2 changed the title I'd like to record a Macro and then run this via the command line to support a scheduled task. I'd like to record a Macro and then run this via the command line to support a scheduled task. Does anyone know if this is possible? I am on version 3.7.1 but can update to the latest build if required. Jul 12, 2023
@otykier
Copy link
Collaborator

otykier commented Jul 12, 2023

@MikkyD2 command line execution of C# scripts can be done through TE2 (since TE3 does not have a CLI). You can use TE3 to record the macro, then save the generated script as a file, which you can then pass into the TE2 CLI using -S myscript.cs.

@MikkyD2
Copy link
Author

MikkyD2 commented Jul 12, 2023

Thank you! I thought I was going mad with not finding command line references in the documentation

@MikkyD2 MikkyD2 closed this as completed Jul 12, 2023
@MikkyD2
Copy link
Author

MikkyD2 commented Jul 12, 2023

Otykier - thanks for the quick help.

A few questions. Have cs scripts been replaced with Tabular Model Scripting Language .tmsl scripts?

Using the command line I've got as far as the following but my credentials aren't being picked up using the following.
The intention is to log onto an incrementally refreshed model on the weekend and fully refresh some tables where data may have change historically (as the vendor datawarehouse doesnt have audit date columns! )

start /wait TabularEditor.exe powerbi://api.powerbi.com/v1.0/myorg/PRIMA PPD -S "Refresh.tmsl" -LOGIN "[email protected]" "MyPas?sword"

@otykier
Copy link
Collaborator

otykier commented Jul 12, 2023

Tabular Editor uses C# scripts - not TMSL. For this reason, it should not be used for data refresh.
If you want to execute TMSL, consider using PowerShell instead: Invoke-ASCmd.

Username/password login does not work with Power BI because of MFA/interactive logins. Instead, you’d have to use a service principal.

@MikkyD2
Copy link
Author

MikkyD2 commented Jul 14, 2023

Thank you so much. The connection is now working and the following may be helpful to someone else (ids all changed)

-- using my username and password
start /wait TabularEditor.exe "Data Source=powerbi://api.powerbi.com/v1.0/myorg/MyWorkspace;User ID=[email protected];Password=Mypassword" MyDatasetName

-- using an SPN. I had this created, added as admin to the workspace and sent to Azure Portal -> App registrations to create a secret/key aka password for logons
start /wait TabularEditor.exe "Data Source=powerbi://api.powerbi.com/v1.0/myorg/EO DEV PRIMA DWH;User ID=app:ac64df9f-a018-44ba-c023-5bbded06fa75@ce56fae6-055d-4c9f-b6c9-9d341505a492;Password=0401f629-d368-42af-8c30-77d5d6c3c1a5" MyDatasetName

Documentation used from
https://docs.tabulareditor.com/te2/Command-line-Options.html
TabularEditor/TabularEditor#828

@MikkyD2
Copy link
Author

MikkyD2 commented Jul 18, 2023

I've opened the not being to run the script issue under TE2 command line

TabularEditor/Scripts#27

Any help appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants