Earlier this month, Microsoft announced the release of Power Platform VS Code Extensions. These extensions allow code-first developers to leverage the command line interface in VS Code to execute useful commands for Power Platform.
To get started, click the Extensions icon at the bottom-left in VS Code and then search power platform and you’ll find Power Platform VS Code Extensions in the list. Lastly, click Install.
Now click Terminal in the toolbar at the top and select New Terminal. This will pull up a new terminal session at the bottom of VS Code.
Now type pac and it will list out the available command types:
Before we can use most of the commands, we first need to setup and authentication profile. In order to do so, we need the URL of the environment, the tenant ID and either a username/password or a client ID and client secret. I used a client ID and client secret:
pac auth create –name <connection name> –url <dataverse url> -id <client id> -t <tenant id> -cs <client secret>
Now we have an authentication profile for our environment and can perform the rest of the commands.
Let’s check out the solution commands. Type pac solution to see the full list of commands.
The command pac solution list can be used to see the full list of solutions in the environment.
We can then use pac solution export -n <solution name> -p <zip path> to export a desired solution.
We can then use the extension to import the solution as well as publish customizations right from VS Code!
Another useful command is the ability to run SQL queries against the environment using the pac org query -s command. This allows us to see necessary data without having to switch back and forth between VS Code and the environment.
Other useful commands are the ability to initialize a plugin project, a PCF project, push a PCF component to the environment and even the ability to download and upload portal content!
It’s great to see Microsoft adding more capabilities for code-first developers. We’re excited to see what else they add to these extensions!