Data entity export error – Azure Storage Emulator issue

I was working on a one-box developer VM that I downloaded from LCS Asset library and updated many times to the newest platform update (It is on PU32, 10.0.8 now). I faced issues with exporting data. Execution log just said “Error(s) while uploading the file-“.

Figure 1.: Entity export execution log: Error(s) while uploading the file-

Event log said: “Error in uploading file to target uri”…”The remote server returned an error: (400) Bad Request.”

Figure 2.: Event log: “Error in uploading file to target uri”…”The remote server returned an error: (400) Bad Request.”

The reason was that Azure Storage Emulator was not running, but I could not start it. I tried to install the newest version from Microsoft docs site here and initialize using ‘AzureStorageEmulator.exe init’ command. An error was thrown while it was trying to initialize at “Creating database AzureStorageEmulatorDb510 on SQL instance ‘(localdb)\MSSQLLocalDB'” at step granting database access to the user:

“Cannot create database ‘AzureStorageEmulatorDb510’ : The login already has an account under a different user name”

Figure 3.: AzureStorageEmulator.exe init error

I could have tried to fix the login name, but an easier solution was to manually create the database AzureStorageEmulatorDb510 (see detailed script below), open cmd as administrator and start the emulator by “AzureStorageEmulator.exe start” command.

Script for creating the database:

USE [master]
GO

/****** Object:  Database [AzureStorageEmulatorDb510]    Script Date: 2/19/2020 1:31:21 PM ******/
CREATE DATABASE [AzureStorageEmulatorDb510]
 CONTAINMENT = NONE
 ON  PRIMARY 
( NAME = N'AzureStorageEmulatorDb510', FILENAME = N'...\MSSQL\DATA\AzureStorageEmulatorDb510.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
 LOG ON 
( NAME = N'AzureStorageEmulatorDb510_log', FILENAME = N'...\MSSQL\DATA\AzureStorageEmulatorDb510_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET COMPATIBILITY_LEVEL = 130
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [AzureStorageEmulatorDb510].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET ANSI_NULL_DEFAULT OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET ANSI_NULLS OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET ANSI_PADDING OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET ANSI_WARNINGS OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET ARITHABORT OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET AUTO_CLOSE OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET AUTO_SHRINK OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET AUTO_UPDATE_STATISTICS ON 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET CURSOR_DEFAULT  GLOBAL 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET CONCAT_NULL_YIELDS_NULL OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET NUMERIC_ROUNDABORT OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET QUOTED_IDENTIFIER OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET RECURSIVE_TRIGGERS OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET  ENABLE_BROKER 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET TRUSTWORTHY OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET PARAMETERIZATION SIMPLE 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET READ_COMMITTED_SNAPSHOT OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET HONOR_BROKER_PRIORITY OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET RECOVERY SIMPLE 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET  MULTI_USER 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET PAGE_VERIFY CHECKSUM  
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET DB_CHAINING OFF 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET TARGET_RECOVERY_TIME = 60 SECONDS 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET DELAYED_DURABILITY = DISABLED 
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET QUERY_STORE = OFF
GO

USE [AzureStorageEmulatorDb510]
GO

ALTER DATABASE SCOPED CONFIGURATION SET LEGACY_CARDINALITY_ESTIMATION = OFF;
GO

ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET LEGACY_CARDINALITY_ESTIMATION = PRIMARY;
GO

ALTER DATABASE SCOPED CONFIGURATION SET MAXDOP = 0;
GO

ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET MAXDOP = PRIMARY;
GO

ALTER DATABASE SCOPED CONFIGURATION SET PARAMETER_SNIFFING = ON;
GO

ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET PARAMETER_SNIFFING = PRIMARY;
GO

ALTER DATABASE SCOPED CONFIGURATION SET QUERY_OPTIMIZER_HOTFIXES = OFF;
GO

ALTER DATABASE SCOPED CONFIGURATION FOR SECONDARY SET QUERY_OPTIMIZER_HOTFIXES = PRIMARY;
GO

ALTER DATABASE [AzureStorageEmulatorDb510] SET  READ_WRITE 
GO

Leave a Reply

Your email address will not be published. Required fields are marked *