Configuring and Using the Storage Emulator with Visual Studio
Updated: May 18, 2012
The Azure SDK development environment includes the storage emulator, a utility that simulates the Blob, Queue, and Table services available in Azure on your local development machine. If you are building a cloud service that employs the Azure storage services, or writing any external application that calls the storage services, you can test your code locally against the storage emulator. The Azure Tools for Microsoft Visual Studio integrate management of the storage emulator into Visual Studio. The Azure Tools initialize the storage emulator database on first use, start the storage emulator service when you run or debug your code from Visual Studio, and provide read-only access to the storage emulator data via the Azure Storage Explorer.
For detailed information on the storage emulator, including system requirements and custom configuration instructions, see Overview of the Azure Storage Emulator in the Azure SDK.
|There are some differences in functionality between the storage emulator simulation and the Azure storage services. See Differences Between the Storage Emulator and Azure Storage Services in the Azure SDK documentation for information on the specific differences.|
Configuring a Connection String for the Storage Emulator
To access the storage emulator from code within a role, you will want to configure a connection string that points to the storage emulator and that can later be changed to point to an Azure storage account. A connection string is a configuration setting that your role can read at runtime to connect to a storage account. For more information about how to create connection strings, see Configuring an Azure Project.
|You can return a reference to the storage emulator account from your code by using the DevelopmentStorageAccount property. This approach works correctly if you want to access the storage emulator from your code, but if you plan to publish your application to Azure, you will need to create a connection string to access your Azure storage account and modify your code to use that connection string before you publish it. If you are switching between the storage emulator account and an Azure storage account frequently, a connection string will simplify this process.|
Initializing and Running the Storage Emulator
You can specify that when you run or debug your service in Visual Studio, Visual Studio automatically launches the storage emulator. In Solution Explorer, open the shortcut menu for your Azure project, and choose Properties. On the Development tab, in the Start Azure Storage Emulator list select True.
The first time you run or debug your service from Visual Studio, the storage emulator launches an initialization process. This process reserves local ports for the storage emulator and creates the storage emulator database. Once complete, this process does not need to run again unless the storage emulator database is deleted.
|Starting with the June 2012 release of the Azure Tools, the storage emulator runs, by default, in SQL Express LocalDB. In earlier releases of the Azure Tools, the storage emulator runs against a default instance of SQL Express 2005 or 2008, which you must install before you can install the Azure SDK. You can also run the storage emulator against a named instance of SQL Express or a named or default instance of Microsoft SQL Server. If you need to configure the storage emulator to run against an instance other than the default instance, see How to Configure SQL Server for the Storage Emulator.|
The storage emulator provides a user interface to view the status of the local storage services and to start, stop, and reset them. Once the storage emulator service has been started, you can display the user interface or start or stop the service by right-clicking on the notification area icon for the Windows Azure Emulator in the Windows taskbar.
Viewing Storage Emulator Data with the Azure Storage Explorer
The Azure Storage Explorer is an extension to the Server Explorer window that is available as part of the Azure Tools for Visual Studio. The Storage Explorer provides read-only access to blob and table data in your storage accounts, including the storage emulator. For more information, see Browsing Storage Resources with Server Explorer.
ConceptsAccessing the Azure Storage Services