question

Teodor Plop avatar image
Teodor Plop asked

Connect with Azure SQL

Hi there!

Since Playfab doesn't currently support queries on a database I am trying to connect to an external one. I am thinking on using Azure SQL Database, but it seems that they do not provide REST APIs to modify tables (or at least I wasn't able to find a proper documentation for that).

Has anyone managed to connect to Azure from Playfab? And if so, how? And if not, what other third party databases do you suggest?

Thanks in advance!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Since queries that either do not effectively scale or which otherwise actively cause performance issues are among the most common causes of problems with online games, and because we designed PlayFab as a service that can replace the need to have a 24/7 Operations staff (which, if you own the queries, you would need to have, to monitor for and respond to issues), we do not support open query on our data tables. It's also worth noting that PlayFab is a multi-tenant service - literally thousands of titles run in PlayFab, and we cannot allow any one of them to impact the others.

For feature designs where you must have your own custom data tables, yes, we'd recommend using Azure. You can find documentation on the Azure SQL database REST API calls here: https://docs.microsoft.com/en-us/rest/api/sql/

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Teodor Plop avatar image Teodor Plop commented ·

Thanks! Managed to perform queries on Azure Table Storage from Playfab.

I ran into one issue though and I'm not sure how to handle it atm. Any idea how to perform batch requests from Playfab?

0 Likes 0 ·
drew avatar image drew Teodor Plop commented ·

Could you please share how you got this working? Are you calling the Azure SQL directly from Cloud Script? Or did you build a seperate layer (such as a Azure Function or web service) which calls the PlayFab APIS?

Originally when I consulted with PlayFab support on this, they advised me to have a Azure Cloud Function call the PlayFab API, but that seems unintuitive. I'd much rather have the Cloud Script call the REST SQL API. This way all the game logic stays within PlayFab.

0 Likes 0 ·
Teodor Plop avatar image Teodor Plop commented ·

I created a storage account on Azure and created a table there. From Playfab Cloud Script I am using HTTP requests to call the Rest API for that storage account and table.

There aren't any tutorials on how to do that from Playfab but I found quite a few ones that teach you how to use Postman to send those requests. After that it's just a matter of learning how to do the same from Playfab Cloud Script.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.