Documentation

Did you find this helpful?

PlayFab (CLI) Command Line Interface

As part of the toolset for using PlayFab, we provide you with a data migration tool that is built into our CLI (Command Line Interface). This set of tools is dedicated to aid in the migration of data from one TitleId to another TitleId. The CLI tool is technically still in beta, but it is currently available for download here. The tool is also open source, which mean you can build off of it and create additional functionality tailored to your needs.

Prerequisites

  • A PC or Mac that can run PC Applications
  • Visual Studio and the ability to build a C# project

To get started:

  • Download the project from the repository
  • Open the .sln file and build the project
  • Copy the build exported to the Release folder from the last step, and place it where you want your CLI to live (ex: C:\PlayFabCLI\)
  • Add that location to your Windows path in your system environment variables
    • On Windows you can find this by clicking Start, typing "environment", and clicking "Edit the system environment variables" 

Now that you can run the PlayFab CLI, the first thing you will want to do is login via the tool. To do so, open a command prompt (click Start, type "cmd" and hit enter).

> PlayFabPowerTools login [playfab email] [playfab password]

This will log you into your account and download the information on all your titles, so it's important to be sure that the account you are logging in with has access to the title you are using for this.

Currently, the CLI has only a few commands:

  1. Login - This allows you to login with a username & password. Login will download the information for all your titles. This is a required step before attempting to modify a title via this tool, but you only need to do this when you first install the CLI, or when you add a title to your PlayFab Account.
  2. SetStores - This allows you to specify which stores you want to import when using migrate.
  3. Migrate - This allows you to migrate from one title to another title.
  4. Help - Displays a help screen.
  5. Exit - Exits console mode.

Modes

There are currently two modes for the PF CLI, there is a CLI mode and a Console mode.

  1. Console mode: To enter into console mode just open up the command prompt, type PlayFabPowerTools, and hit enter
  2. CLI mode: Any command can be executed directly from CLI mode, open a command prompt and type PlayFabPowerTools [command] [args], and hit enter (this is the recommended route for automation)

Even when using CLI mode, you still only need to authenticate once, but it's a good idea to log in each time, so that you get an updated list of and titles.

So, in this example:

> login [user] [password]
> SetStores ["storeid1","storeid2"]
> migrate [titleid-1] [titleid-2]

After login, the CLI is set to copy stores "storeid1" and "storeid2", then a migration is kicked off, copying all of the following (in order):

  • TitleData
  • TitleDataInternal
  • CloudScripts
  • Files
  • Currency
  • Catalogs
  • DropTables
  • Stores

Please note that if you have drop tables, bundles, or containers that reference drop tables, that may cause the import to break, due to the dependency chain (the drop table being referenced may not exist yet). We will be updating the tool to support this later, but for now the way to work around this is to remove those references before migration, and set them back up as a post-migration step.



Did you find this helpful?