Setup Google Cloud Server
- Create an Microsoft SQL Server "xpert-server" on Google Cloud.
- Install GCloud CLI (https://cloud.google.com/sdk/docs/install).
- Run "gcloud auth login" to authenticate.
- Install .NET by running "sudo apt-get install -y dotnet-sdk-8.0"
- Install sqlpackage by running "dotnet tool install -g microsoft.sqlpackage"
- Run "export PATH="$PATH:/home/nassoskranidiotis/.dotnet/tools""
- On SQL/Connections/Networking/Authorized Networks, allow 0.0.0.0/0
- On SQL/Connection/Security, allow unencrypted network traffic.
- Run the following command to import a bacpac file and create a new database:
sqlpackage /Action:Import /tsn:server_IP_here,1433 /tdn:db_name /tu:username_here /sf:db.bacpac /TargetTrustServerCertificate:True /tp:"your_password_here"
- To export a bacpac, run:
sqlpackage /Action:Export /SourceServerName:server_IP_here,1433 /SourceDatabaseName:db_name /SourceUser:username_here /SourcePassword:"your_password_here" /TargetFile:db1.bacpac /SourceTrustServerCertificate:True