No default service level objective found of edition "GeneralPurpose" - azure

I am getting this error No default service level objective found of edition "GeneralPurpose" in SSMS when creating database in Azure SQL

Please download the latest SQL Server Management Studio version from here. Version 18.0 has many fixes related to Azure Managed Instances.
It is a limitation of the free subscription you are using at this time. ""'Free Trial subscriptions can provision Basic, Standard S0 through S3 databases, up to 100 eDTU Basic or Standard elastic pools and DW100 through DW400 data warehouses"
You can also try to create the database using T-SQL as shown below.
CREATE DATABASE Testdb
( EDITION = 'Standard', SERVICE_OBJECTIVE = 'S3' );
GO

In my case it was because I had wrong connection string in my app settings(.NET).
To find your connection string you need to go to your db on azure and in overview you need to find "connection string".

Related

Restore database on another server in azure with terraform

How do you restore an azure sql database using terraform on another server from a backup?
Terraform docs talk about a create mode "RestoreExternalBackup". How could one use that?
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_database
I researched this issue and found it to be a discrepancy between the Terraform and Azure documentation. I also opened an issue on the GitHub repo with this info.
RestoreExternalBackup is listed as a possible value for CreateMode in the Azure API documentation for databases. However, the create mode documentation doesn't describe how to use it. This option should not be available.
Looking at the Managed Database documentation, it clearly defines how to use the RestoreExternalBackup option. Oddly enough the Terraform documentation doesnt list any create modes for managed databases. https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_managed_database
When trying to use RestoreExternalBackup to create a database the error indicates that option requires a pointer to a storage account with the message "Missing storage container URI". Storage account information is not a valid property when creating a database resource, only for a managed database resource.
Database = https://learn.microsoft.com/en-us/rest/api/sql/2022-05-01-preview/databases/create-or-update?tabs=HTTP
Managed Database Docs = https://learn.microsoft.com/en-us/rest/api/sql/2022-05-01-preview/managed-databases/create-or-update?tabs=HTTP

Azure SQL database availability after creation

I'm trying to configure an Azure pipeline where I create a copy of a production database to create a "pre-prod" environment.
After create that database I need to run some queries in the freshly created database. The problem is database is not available right away. As the process is automatic I need to know for how long I need to wait.
I put a wait step for 5 minutes but sometimes is not enough.
Thanks in advance
How about using a simple check of DB availability, through Az module, or CLI?
do {
sleep 120
$status = "Offline"
try{
$status = (Get-AzSqlDatabase -ResourceGroupName "resourcegroup01" -ServerName "server01"-DatabaseName "MyDataBase").Status
}
catch
{
"Database not available yet"
}
} while ($status -ne "Online")
You can try to use the Azure portal's query editor to query an Azure SQL Database to check DB availability.
The query editor is a tool in the Azure portal for running SQL queries against your database in Azure SQL Database or data warehouse in Azure Synapse Analytics.
Note: The query editor uses ports 443 and 1443 to communicate. Ensure you have enabled outbound HTTPS traffic on these ports. You also need to add your outbound IP address to the server's allowed firewall rules to access your databases and data warehouses.
For more query editor considerations, please refer to this.

getting "the given header is not found" while connecting to cosmos db

trying to insert data into cosmo db but while trying to verify in connection string getting error as shown in figure,
After my test,I reproduce your issue when I try to configure the AccountName to be my cosmos db table api.
Based on this official statement, The UI based Data Migration tool (dtui.exe) is not currently supported for Table API accounts.
You could try to use command-line Azure Cosmos DB Data Migration tool (dt.exe).
If I connected to Cosmos DB SQL API, everything was fine.
Hope it helps you.
You should also pay attention to the domain in you "AccountEndpoint" string. Azure portal gives "AccountEndpoint" in "Connection String" section of "Azure Cosmos DB account" service and it looks like https://$YOUR_ACCOUNTNAME.table.cosmos.azure.com:443/. If you try to work with this endpoint in dt.exe - you'll get the described error. In case if you replace "table.cosmos.azure.com:443/" with "documents.azure.com:443/" - you'll pass the verifying successfully. This trick with domains and non-informative error have wasted 1 hour of my only life.

Azure db users and permissions reporting

I am trying to come up with a solution/tool that can cycle through all our azure db servers and generate a report of USERS/PERMISSIONS for each db. Anyone have any ideas?
You can use the SMO library in Azure-SQL to loop through all Azure SQL databases on a logical Azure SQL server as explained here. You can then run the following query on each database:
SELECT DISTINCT pr.principal_id, pr.name, pr.type_desc,
pr.authentication_type_desc, pe.state_desc, pe.permission_name
FROM sys.database_principals AS pr
JOIN sys.database_permissions AS pe
ON pe.grantee_principal_id = pr.principal_id;

AzureSQL: What is the automation/script name for PremiumRS service tiers?

In AzureSQL, what is the name for PremiumRS service tiers?
My automation script upsizes my database from Standard S3 to Premium P1 each morning at 6am but I wish to change this to upsize to PremiumRS PS1.
This is the script I'm using:
https://gallery.technet.microsoft.com/scriptcenter/Azure-SQL-Database-e957354f
Service tiers are PRS1, PRS2, PRS4 and PRS6. I would also recommend to you double checking availability regions.
For service tiers:
http://blog.nilayparikh.com/azure/sql/update-microsoft-azure-sql-database-increase-storage-up-to-4tb/
For regions:
https://azure.microsoft.com/en-us/blog/sql-database-4tb-premium-and-premium-rs-preview/
See the Create Database (Azure SQL Database) topic at https://msdn.microsoft.com/en-us/library/dn268335.aspx for the syntax for create.
Similarly, see the Alter Database (Azure SQL Database) topic at https://msdn.microsoft.com/en-us/library/mt574871.aspx

Resources