How to create Azure SQL "serverless" database instance usig Azure SQL API in python?

Aswin 26 Reputation points
2020-06-05T05:59:05.67+00:00

I am developing an Azure base solution in Django. In that how can I allow user to login using his Azure Active directory Account and create an SQL server first, then create a "Server-less" instance of database with predefined database name?
Is there any Azure API for this particular requirement?
Making the database server-less is important for my requirement.
I do not have much experience in handling API's, if my approach is wrong please feel free to point out.
Thanks in advance

Azure SQL Database
{count} vote

Accepted answer
  1. Ronen Ariely 15,096 Reputation points
    2020-06-05T10:00:45.8+00:00

    Good day Aswin ( @Aswin ),

    Option 1: Direct work with Azure Python API

    Azure have a full Azure libraries (SDK) for Python, which allow you to provisioning, managing, and using Azure resources from Python application code.

    The following document is the Python developers entery point to the Azure world:

    https://learn.microsoft.com/en-us/azure/developer/python/

    The following list the Azure libraries (SDK) for Python:

    https://learn.microsoft.com/en-us/azure/developer/python/azure-sdk-overview

    And here you have a sample step-by-step to all that you asked and more

    https://learn.microsoft.com/en-us/samples/azure-samples/sql-database-python-manage/sql-database-python-manage/ including: Create a SQL Server instance, Create a Firewall rule, List servers by resource group, List servers by subscription, List server usages, Create a database, Get a database, List databases, List database usages, Delete a database, Delete a SQL Server instance.

    Option 2: You can use simple Transact-SQL in order to create the database. This is done using simple CREATE DATABASE commant

    https://learn.microsoft.com/en-us/sql/t-sql/statements/create-database-transact-sql?view=azuresqldb-current

    Note: By the way, I am not working with python and I had no idea what is the solution till 20 minutes ago, but I have a browser and I have Google in the other side. I really think that people should use search engine more before asking for help, and learn how to find their needs as part of their professional ability. Forums are extremely important to get help but should come after the the step of Google. In this case, I simply search for what you ask for using your words: azure api python. and first result was the answer

    I hope that this cover your need and was helpful 😀

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful