-->![Sql Sql](https://software-advice.imgix.net/managed/products/screenshots/screenshot_66887.png?auto=format&w=600&h=450)
Easily manage your Azure storage accounts in the cloud, from Windows, macOS, or Linux, using Azure Storage Explorer. Azure Storage Explorer – cloud storage management Microsoft Azure Skip Navigation.
- RazorSQL - Query, Edit, Browse, and Manage Databases. RazorSQL is an SQL query tool, database browser, SQL editor, and database administration tool for Windows, macOS, Mac OS X, Linux, and Solaris. RazorSQL has been tested on over 40 databases, can connect to databases via either JDBC or ODBC, and includes support for the following databases.
- DB Explorer is an easy-to-use application that lets you manage any JDBC (Java Database Connectivity) compliant database. It provides connectivity to wide-range of SQL databases through their JDBC.
Using Azure Cosmos DB in Azure Storage Explorer enables users to manage Azure Cosmos DB entities, manipulate data, update stored procedures and triggers along with other Azure entities like Storage blobs and queues. Now you can use the same tool to manage your different Azure entities in one place. At this time, Azure Storage Explorer supports Cosmos accounts configured for SQL, MongoDB, Graph, and Table APIs.
Prerequisites
A Cosmos account with SQL API or Azure Cosmos DB's API for MongoDB. If you don't have an account, you can create one in the Azure portal, as described in Azure Cosmos DB: Build a SQL API web app with .NET and the Azure portal.
Installation
Install the newest Azure Storage Explorer bits here: Azure Storage Explorer, now we support Windows, Linux, and MAC version.
Free Microsoft Sql Server
Connect to an Azure subscription
- After installing the Azure Storage Explorer, click the plug-in icon on the left as shown in the following image:
- Select Add an Azure Account, and then click Sign-in.
- In the Azure Sign in dialog box, select Sign in, and then enter your Azure credentials.
- Select your subscription from the list and then click Apply.The Explorer pane updates and displays the accounts in the selected subscription.You have successfully connected to your Cosmos DB account to your Azure subscription.
Connect to Azure Cosmos DB by using a connection string
An alternative way of connecting to an Azure Cosmos DB is to use a connection string. Use the following steps to connect using a connection string.
- Find Local and Attached in the left tree, right-click Cosmos DB Accounts, choose Connect to Cosmos DB..
- Only support SQL and Table API currently. Choose API, paste Connection String, input Account label, click Next to check the summary, and then click Connect to connect Azure Cosmos DB account. For information on retrieving the primary connection string, see Get the connection string.
Connect to Azure Cosmos DB by using local emulator
Use the following steps to connect to an Azure Cosmos DB by Emulator, only support SQL account currently.
- Install Emulator and launch. For how to install Emulator, seeCosmos DB Emulator
- Find Local and Attached in the left tree, right-click Cosmos DB Accounts, choose Connect to Cosmos DB Emulator..
- Only support SQL API currently. Paste Connection String, input Account label, click Next to check the summary, and then click Connect to connect Azure Cosmos DB account. For information on retrieving the primary connection string, see Get the connection string.
Azure Cosmos DB resource management
You can manage an Azure Cosmos DB account by doing following operations:
- Open the account in the Azure portal
- Add the resource to the Quick Access list
- Search and refresh resources
- Create and delete databases
- Create and delete collections
- Create, edit, delete, and filter documents
- Manage stored procedures, triggers, and user-defined functions
Quick access tasks
By right-clicking on a subscription in the Explorer pane, you can perform many quick action tasks:
- Right-click an Azure Cosmos DB account or a database, you can choose Open in Portal and manage the resource in the browser on the Azure portal.
- You can also add Azure Cosmos DB account, database, collection to Quick Access.
- Search from Here enables keyword search under the selected path.
Database and collection management
Create a database
- Right-click the Azure Cosmos DB account, choose Create Database, input the database name, and press Enter to complete.
Delete a database
- Right-click the database, click Delete Database, and click Yes in the pop-up window. The database node is deleted, and the Azure Cosmos DB account refreshes automatically.
Create a collection
- Right-click your database, choose Create Collection, and then provide the following information like Collection ID, Storage capacity, etc. Click OK to finish.
- Select Unlimited to be able to specify partition key, then click OK to finish.If a partition key is used when creating a collection, once creation is completed, the partition key value can't be changed on the collection.
Delete a collection
- Right-click the collection, click Delete Collection, and then click Yes in the pop-up window.The collection node is deleted, and the database refreshes automatically.
Document management
Create and modify documents
Microsoft Edge Browser Mac
- To create a new document, open Documents in the left window, click New Document, edit the contents in the right pane, then click Save. You can also update an existing document, and then click Save. Changes can be discarded by clicking Discard.
Delete a document
- Click the Delete button to delete the selected document.
Query for documents
- Edit the document filter by entering a SQL query and then click Apply.
Graph management
Create and modify vertex
- To create a new vertex, open Graph from the left window, click New Vertex, edit the contents, then click OK.
- To modify an existing vertex, click the pen icon in the right pane.
Delete a graph
- To delete a vertex, click the recycle bin icon beside the vertex name.
Filter for graph
- Edit the graph filter by entering a gremlin query and then click Apply Filter.
Table management
Create and modify table
- To create a new table, open Entities from the left window, click Add, edit the content in Add Entity dialog, add property by clicking button Add Property, then click Insert.
- To modify a table, click Edit, modify the content, then click Update.
Import and export table
- To import, click Import button and choose an existing table.
- To export, click Export button and choose a destination.
Delete entities
- Select the entities and click button Delete.
Query table
- Click Query button, input query condition, then click Execute Query button. Close Query pane by clicking Close Query button.
Manage stored procedures, triggers, and UDFs
- To create a stored procedure, in the left tree, right-click Stored Procedure, choose Create Stored Procedure, enter a name in the left, type the stored procedure scripts in the right window, and then click Create.
- You can also edit existing stored procedures by double-clicking, making the update, and then clicking Update to save, or click Discard to cancel the change.
- The operations for Triggers and UDF are similar with Stored Procedures.
Troubleshooting
Azure Cosmos DB in Azure Storage Explorer is a standalone app that allows you to connect to Azure Cosmos DB accounts hosted on Azure and Sovereign Clouds from Windows, macOS, or Linux. It enables you to manage Azure Cosmos DB entities, manipulate data, update stored procedures and triggers along with other Azure entities like Storage blobs and queues.
These are solutions for common issues seen for Azure Cosmos DB in Storage Explorer.
Sign in issues
Before proceeding further, try restarting your application and see if the problems can be fixed.
Self-signed certificate in certificate chain
There are a few reasons you may be seeing this error, the two most common ones are:
- You're behind a transparent proxy, which means someone (such as your IT department) is intercepting HTTPS traffic, decrypting it, and then encrypting it using a self-signed certificate.
- You're running software, such as anti-virus software, which is injecting a self-signed TLS/SSL certificates into the HTTPS messages you receive.
When Storage Explorer encounters one of these 'self-signed certificates', it can no longer know if the HTTPS message it's receiving has been tampered with. If you have a copy of the self-signed certificate though, then you can tell Storage Explorer to trust it. If you're unsure of who is injecting the certificate, then you can try to find it yourself by doing the following steps:
- Install OpenSSL
- Windows (any of the light versions is ok)
- Mac and Linux: Should be included with your operating system
- Run OpenSSL
- Windows: Go to the install directory, then /bin/, then double-click on openssl.exe.
- Mac and Linux: execute openssl from a terminal
- Execute
s_client -showcerts -connect microsoft.com:443
- Look for self-signed certificates. If you're unsure, which are self-signed, then look for anywhere the subject ('s:') and issuer ('i:') are the same.
- Once you have found any self-signed certificates, copy and paste everything from and including -----BEGIN CERTIFICATE----- to -----END CERTIFICATE----- to a new .cer file for each one.
- Open Storage Explorer and then go to Edit > SSL Certificates > Import Certificates. Using the file picker, find, select, and open the .cer files you created.
If you're unable to find any self-signed certificates using the above steps, could send feedback for more help.
Unable to retrieve subscriptions
If you're unable to retrieve your subscriptions after you successfully signed in:
- Verify your account has access to the subscriptions by signing into the Azure Portal
- Make sure you have signed in using the correct environment (Azure, Azure China, Azure Germany, Azure US Government, or Custom Environment/Azure Stack)
- If you're behind a proxy, make sure that you have configured the Storage Explorer proxy properly
- Try removing and readding the account
- Try deleting the following files from your home directory (such as: C:UsersContosoUser), and then readding the account:
- .adalcache
- .devaccounts
- .extaccounts
- Watch the developer tools console (f12) while signing in for any error messages
Unable to see the authentication page
If you're unable to see the authentication page:
- Depending on the speed of your connection, it may take a while for the sign-in page to load, wait at least one minute before closing the authentication dialog
- If you're behind a proxy, make sure that you have configured the Storage Explorer proxy properly
- Bring up the developer console by pressing F12 key. Watch the responses from developer console and see if you can find any clue for why authentication is not working
Cannot remove account
If you're unable to remove an account, or if the reauthenticate link does not do anything
- Try deleting the following files from your home directory, and then readding the account:
- .adalcache
- .devaccounts
- .extaccounts
- If you want to remove SAS attached Storage resources, delete:
- %AppData%/StorageExplorer folder for Windows
- /Users/<your_name>/Library/Application SUpport/StorageExplorer for Mac
- ~/.config/StorageExplorer for Linux
- You will have to reenter all your credentials if you delete these files
![Sql Sql](https://software-advice.imgix.net/managed/products/screenshots/screenshot_66887.png?auto=format&w=600&h=450)
Http/Https proxy issue
You cannot list Azure Cosmos DB nodes in left tree when configuring http/https proxy in ASE. It's a known issue, and will be fixed in next release. You could use Azure Cosmos DB data explorer in Azure portal as a work-around at this moment.
'Development' node under 'Local and Attached' node issue
There is no response after clicking the 'Development' node under 'Local and Attached' node in left tree. The behavior is expected. Azure Cosmos DB local emulator will be supported in next release.
Attaching Azure Cosmos DB account in 'Local and Attached' node error
If you see below error after attaching Azure Cosmos DB account in 'Local and Attached' node, then check if you're using the right connection string.
Expand Azure Cosmos DB node error
You may see below error while trying to expand the tree nodes in left.
Try the following suggestions:
- Check if the Azure Cosmos DB account is in provision progress and try again when the account is being created successfully.
- If the account is under 'Quick Access' node or 'Local and Attached' nodes, then check if the account has been deleted. If so, you need to remove the node manually.
Contact us
If none of the solutions work for you, send email to Azure Cosmos DB Dev Tooling Team ([email protected]) with details about the issue, for fixing the issues.
Next steps
- Watch the following video to see how to use Azure Cosmos DB in Azure Storage Explorer: Use Azure Cosmos DB in Azure Storage Explorer.
- Learn more about Storage Explorer and connect more services in Get started with Storage Explorer.
By Rick Anderson and Joe Audette
View or download sample code (how to download).
The
RazorPagesMovieContext
object handles the task of connecting to the database and mapping Movie
objects to database records. The database context is registered with the Dependency Injection container in the ConfigureServices
method in Startup.cs:The ASP.NET Core Configuration system reads the
ConnectionString
. For local development, it gets the connection string from the appsettings.json file.The name value for the database (
Database={Database name}
) will be different for your generated code. The name value is arbitrary.When the app is deployed to a test or production server, an environment variable can be used to set the connection string to a real database server. See Configuration for more information.
SQL Server Express LocalDB
LocalDB is a lightweight version of the SQL Server Express database engine that's targeted for program development. LocalDB starts on demand and runs in user mode, so there's no complex configuration. By default, LocalDB database creates
*.mdf
files in the C:Users<user>
directory.- From the View menu, open SQL Server Object Explorer (SSOX).
- Right click on the
Movie
table and select View Designer:
Note the key icon next to
ID
. By default, EF creates a property named ID
for the primary key.- Right click on the
Movie
table and select View Data:
SQLite
The SQLite website states:
SQLite is a self-contained, high-reliability, embedded, full-featured, public-domain, SQL database engine. SQLite is the most used database engine in the world.
There are many third party tools you can download to manage and view a SQLite database. The image below is from DB Browser for SQLite. If you have a favorite SQLite tool, leave a comment on what you like about it.
Note
For this tutorial you use the Entity Framework Core migrations feature where possible. Migrations updates the database schema to match changes in the data model. However, migrations can only do the kinds of changes that the EF Core provider supports, and the SQLite provider's capabilities are limited. For example, adding a column is supported, but removing or changing a column is not supported. If a migration is created to remove or change a column, the
ef migrations add
command succeeds but the ef database update
command fails. Due to these limitations, this tutorial doesn't use migrations for SQLite schema changes. Instead, when the schema changes, you drop and re-create the database.The workaround for the SQLite limitations is to manually write migrations code to perform a table rebuild when something in the table changes. A table rebuild involves:
- Creating a new table.
- Copying data from the old table to the new table.
- Dropping the old table.
- Renaming the new table.
For more information, see the following resources:
Seed the database
Create a new class named
SeedData
in the Models folder with the following code:If there are any movies in the DB, the seed initializer returns and no movies are added.
Add the seed initializer
In Program.cs, modify the
Main
method to do the following:- Get a DB context instance from the dependency injection container.
- Call the seed method, passing to it the context.
- Dispose the context when the seed method completes.
The following code shows the updated Program.cs file.
The following exception occurs when
Update-Database
has not been run:SqlException: Cannot open database 'RazorPagesMovieContext-' requested by the login. The login failed.
Login failed for user 'user name'.
Test the app
- Delete all the records in the DB. You can do this with the delete links in the browser or from SSOX
- Force the app to initialize (call the methods in the
Startup
class) so the seed method runs. To force initialization, IIS Express must be stopped and restarted. You can do this with any of the following approaches:- Right click the IIS Express system tray icon in the notification area and tap Exit or Stop Site:
- If you were running VS in non-debug mode, press F5 to run in debug mode.
- If you were running VS in debug mode, stop the debugger and press F5.
Delete all the records in the DB (So the seed method will run). Stop and start the app to seed the database.
The app shows the seeded data.
The next tutorial will improve the presentation of the data.
Additional resources
View or download sample code (how to download).
The
RazorPagesMovieContext
object handles the task of connecting to the database and mapping Movie
objects to database records. The database context is registered with the Dependency Injection container in the ConfigureServices
method in Startup.cs:For more information on the methods used in
ConfigureServices
, see:- EU General Data Protection Regulation (GDPR) support in ASP.NET Core for
CookiePolicyOptions
.
The ASP.NET Core Configuration system reads the
ConnectionString
. For local development, it gets the connection string from the appsettings.json file.The name value for the database (
Database={Database name}
) will be different for your generated code. The name value is arbitrary.When the app is deployed to a test or production server, an environment variable can be used to set the connection string to a real database server. See Configuration for more information. Microsoft office 2013 for mac kickass.
SQL Server Express LocalDB
LocalDB is a lightweight version of the SQL Server Express database engine that's targeted for program development. LocalDB starts on demand and runs in user mode, so there's no complex configuration. By default, LocalDB database creates
*.mdf
files in the C:/Users/<user/>
directory.- From the View menu, open SQL Server Object Explorer (SSOX).
- Right click on the
Movie
table and select View Designer:
Note the key icon next to
ID
. By default, EF creates a property named ID
for the primary key.- Right click on the
Movie
table and select View Data:
SQLite
The SQLite website states:
SQLite is a self-contained, high-reliability, embedded, full-featured, public-domain, SQL database engine. SQLite is the most used database engine in the world.
There are many third party tools you can download to manage and view a SQLite database. The image below is from DB Browser for SQLite. If you have a favorite SQLite tool, leave a comment on what you like about it.
Note
For this tutorial you use the Entity Framework Core migrations feature where possible. Migrations updates the database schema to match changes in the data model. However, migrations can only do the kinds of changes that the EF Core provider supports, and the SQLite provider's capabilities are limited. For example, adding a column is supported, but removing or changing a column is not supported. If a migration is created to remove or change a column, the
ef migrations add
command succeeds but the ef database update
command fails. Due to these limitations, this tutorial doesn't use migrations for SQLite schema changes. Instead, when the schema changes, you drop and re-create the database.The workaround for the SQLite limitations is to manually write migrations code to perform a table rebuild when something in the table changes. A table rebuild involves:
- Creating a new table.
- Copying data from the old table to the new table.
- Dropping the old table.
- Renaming the new table.
For more information, see the following resources:
SQLite
The SQLite website states:
SQLite is a self-contained, high-reliability, embedded, full-featured, public-domain, SQL database engine. SQLite is the most used database engine in the world.
There are many third party tools you can download to manage and view a SQLite database. The image below is from DB Browser for SQLite. If you have a favorite SQLite tool, leave a comment on what you like about it.
Note
For this tutorial you use the Entity Framework Core migrations feature where possible. Migrations updates the database schema to match changes in the data model. However, migrations can only do the kinds of changes that the EF Core provider supports, and the SQLite provider's capabilities are limited. For example, adding a column is supported, but removing or changing a column is not supported. If a migration is created to remove or change a column, the
ef migrations add
command succeeds but the ef database update
command fails. Due to these limitations, this tutorial doesn't use migrations for SQLite schema changes. Instead, when the schema changes, you drop and re-create the database.The workaround for the SQLite limitations is to manually write migrations code to perform a table rebuild when something in the table changes. A table rebuild involves:
- Creating a new table.
- Copying data from the old table to the new table.
- Dropping the old table.
- Renaming the new table.
For more information, see the following resources:
Seed the database
Create a new class named
SeedData
in the Models folder with the following code:If there are any movies in the DB, the seed initializer returns and no movies are added.
Add the seed initializer
In Program.cs, modify the
Main
method to do the following:- Get a DB context instance from the dependency injection container.
- Call the seed method, passing to it the context.
- Dispose the context when the seed method completes.
The following code shows the updated Program.cs file.
A production app would not call
Database.Migrate
. It's added to the preceding code to prevent the following exception when Update-Database
has not been run:SqlException: Cannot open database 'RazorPagesMovieContext-21' requested by the login. The login failed.Login failed for user 'user name'.
Test the app
- Delete all the records in the DB. You can do this with the delete links in the browser or from SSOX
- Force the app to initialize (call the methods in the
Startup
class) so the seed method runs. To force initialization, IIS Express must be stopped and restarted. You can do this with any of the following approaches:- Right-click the IIS Express system tray icon in the notification area and tap Exit or Stop Site:
- If you were running VS in non-debug mode, press F5 to run in debug mode.
- If you were running VS in debug mode, stop the debugger and press F5.
Delete all the records in the DB (So the seed method will run). Stop and start the app to seed the database.
The app shows the seeded data.
Delete all the records in the DB (So the seed method will run). Stop and start the app to seed the database.
What Is Sql Server Browser
The app shows the seeded data.
The app shows the seeded data:
The next tutorial will clean up the presentation of the data.