EF 4.1 CF + Azure: CREATE DATABASE permission denied in database 'master' - azure

I have an ASP.NET WebForms application which uses EF 4.1 Codefirst.
Running my application the first time creates a new database, tables etc.
Everything has been working fine so far.
But after adding my application as a WebRole to an Azure Project I got an error message when I first hit the database (CREATE DATABASE permission denied in database 'master').
Obviously it makes a difference if I start my application inside the VS Development Webserver or inside the Azure Emulator.
Here is some additional information which I believe could be relevant:
The database does NOT exist when I run the application
Visual Studio 2010 run as Administrator
Trust level of my web role: Full trust
SQL Server service (MS SQL 2008 R2 Express) is up and running
The connection string in my web.config looks like this:
<add name="dbContext" connectionString="server=(local)\SQLEXPRESS;database=myDB;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
I also tried using a real user instead of "integrated security". And that user had all possible database roles assigned, including sysadmin, serveradmin etc.
How I can I grant the necessary permissions to my application in order to allow creating a database while running inside the Azure emulator?
Thanks so much for your help!

Azure emulator runs with the credentials of "Network Service" account. You need to add credentials for "Network Service" account on master database.

Related

App Pool Login Failed Message in New Acumatica Version

I am using Acumatica 2018 R2 build 18.204.0013.
I have created a new instance on my local with Windows Authentication. However, when I launch the application, it gave me below error.
Error: - "Login Failed for user 'IIS APPPOOL\apppoolname"
I have also other instances running different versions with Windows Authentication which are working fine but they are all upgraded from lower versions to the latest.
I have observed that if I create a new instance with SQL Authentication instead of Windows Authentication then it works. This started happening from 2018 R2 I think. Is there anything changed or any recommendation that we should be using SQL authentication always going forward from 2018 R2. Please suggest.
When creating the database using Acumatica ERP Configuration Wizard, an AppPool User is inserted in the database security settings:
The Login for user IIS/AppPool failed error can happen when you backup/restore a database for use with a different website that uses a different AppPool. It is a mismatch between AppPool used by the IIS website instance and the Database User in Security.
Adding the missing IIS/AppPool User in the database security should resolve the error. It is easier to create it from the UI using Microsoft SQL Management Studio. The user requires membership for 'db_datareader', 'db_datawriter' and 'db_ddladmin' role:
Finally found the solution.
Create an instance with SQL Authentication and not Windows Authentication.
I fixed this by adding the IIS AppPool user to the database as DBO in SSMS. Adding it with db_datareader, db_datawriter, and db_ddladmin was causing another error when trying to log in to Acumatica. I was having this issue on 18.115 and 18.116, new instance with no data. It's like the Acumatica install did not set up the database permissions.

Problems deploying a SSAS cube in Azure

I am having problems deploying a ssas cube in Azure. I have designed a cube in SSDT.
The structure of the cube is correct and I can access to the database placed in azure machine
from my local laptop.My SSDT project is created in my local laptop. I have tried ti deploy to azure machine and
get the following error;
"The project could not be deployed to the 'mbitsql.westeurope.cloudapp.azure.com' server because of the following connectivity problems :
A connection cannot be made. Ensure that the server is running.To
verify or update the name of the target server, right-click on the
project in Solution Explorer, select Project Properties, click on the
Deployment tab, and then enter the name of the server."
These are my tests or checks:
The cube is correct generated, the error is in deployment
I can access to Azure sql server database succesfuly, the problem is with the analysis services.
I have checked the server name in the implementation propierties, I have tested with DNS name
and with IP.
I have checked to access Analysis services from the ssms of Azure and I can access. I have
checked that analysis services and sql browser services are running (both local account)
I have created security input rules ion azure to allow access to 2382 port
I don't know where is the problem.... I use SQL Server 2016 y SSDT 2015
There is something, that I don't understand, I have given an user/pass in the datasource to access
to sql server azure database, but in the project there isn't a place to put the user/pass for SSAS.
I don't understand this, because if you log from SSMS you always put a user/pass for both (sql server database and ssas)
Did you open 2382 or 2383? 2383 is correct unless you customized the SSAS port.
Is the Azure VM domain joined? If you are logged into your laptop as MYDOMAIN\juan do you use that same user to Remote Desktop to the VM? If not close and open SSDT with:
runas /netonly /user:mbitsql\vmUserName "c:\pathTo\devenv.exe" so that SSDT can authenticate with the VM when you deploy.

Azure Active Directory Connection String

I've been trying to set up my IIS website's connection string to connect to an Azure SQL Database with the following connection string:
<add name="ConnectionString" connectionString="Server=tcp:some.database.windows.net,1433;Database=myDB;Authentication=Active Directory Integrated;" />
The IIS application pool is using a service account which has Azure Active Directory privileges and is added as an user on the Azure SQL Database.
This works fine on my local development machine (probably because it is using my credentials and not a service account) but when I place the site on IIS I get:
System.ArgumentException: Keyword not supported: 'authentication'.
Does anyone know the correct syntax for logging in via Azure AD?
Have you been through this troubleshooting guide, https://azure.microsoft.com/en-us/documentation/articles/sql-database-aad-authentication/#5-configure-your-client-computers?
In particular, do you have .NET Framework 4.6 or later installed?

How can I deploy my database from SQL Server 2008 Express to Azure SQL Database

I am using Visual Studio Community 2013, SQL Server 2008 R2 Express Edition for an MVC web application using entity framework code first migrations for my database.
I am trying to get my local application hosted on the Microsoft Azure platform.
I have registered for a trial account which expires in 30 days, and deployed my MVC5 app out which has been successful.
However, this app requires a database which I am struggling to deploy.
What is the easiest way to get my database deployed out to Azure as I do not seem to have the :
"Tasks" -> "Deploy Database to Microsoft Azure SQL Database" option available to me in SSMS.
I have extracted a Data-tier Application of my local database and have it stored on my C drive, however if I connect to my Azure Account in a second window, and right click the server then select Deploy Data-tier Application, it fails on "Creating schema object in database" with the following error:
TITLE: Microsoft SQL Server Management Studio
An exception occurred while executing a Transact-SQL statement or
batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------ ADDITIONAL INFORMATION:
Users cannot be mapped to certificates, asymmetric keys, or Windows
logins in this version of SQL Server. (Microsoft SQL Server, Error:
40528)
I'm assuming its tried to create my local account plus the IIS APPPOOL account I had to set up to host the website on my local network, however I do not see a way of removing them from the .dacpac export.
When I refresh the Databases node, there is still no database, I'm fairly lost now as to how I might get my db deployed to this server?
If you can extract a compatible Data-tier application and then Deploy it to your target server using your current version of Management studio, then this approach should work, see this link for more reading on ensuring your database is compatible.
Failing this, as was in my case. I downloaded Management Studio 2015, which gave me the option to deploy database to Azure by simply right clicking the required database.
Again, this threw up the error regarding my database level IISAPPOOL user, but not my server account user. As a way around this, I took a backup/restore of the database and removed this user then deployed the copy database obviously minus the problem account.
Now all that was left to do was add a transform to my Release web.config with the Azure connection string as provided on the Azure dashboard, and re-deploy the website.
Problem solved.

Visual Studio 2012 - Windows Azure : connection string not working (no database interaction)

I'm trying to put my Visual Studio 2012 MVC 4 project online using the Cloud Technology provided by Windows Azure.
Although i can get to my website (it uploads well and is accessible), I can't manage to make the data connection work.
For exemple, when I try to register a new user to my live application, it returns me a simple mistake : "A mistake happened while handling your request" (that's a translation from french, though... --')
I've followed a bunch of tutorial all around the web, but none seems to make things work.
Here's the connection string I actually use :
<add name="yoombysql"
providerName="System.Data.SqlClient"
connectionString="Data Source=tcp:rmy11na948.database.windows.net,1433;Initial Catalog=yoombysql;Integrated Security=False;User Id=yoomby;Password=PASSWORD;Encrypt=True;TrustServerCertificate=False;MultipleActiveResultSets=True" />
It's not the only thing I've tried, but i'm running out of ideas... So if anyone had a hint or a clue on this...
Thanks in advance !
Make sure that in your control panel for the DB rmy11na948 on the right side under "Manage allowed ip addresses" you have checked WINDOWS AZURE SERVICES = "YES" and if you are accessing Azure SQL outside of Azure, you need to add your specific IP address for testing.
UPDATE: You should add the full userId as well User Id=yoomby#rmy11na948;
Again, from the portal on the right side click "Show connection strings", copy the ADO.NET connection string and replace the {your_password_here}. If that fails, then walk through the steps at Windows Azure SQL Database Firewall.
UPDATE-2: For Entity Framework connections, read How to: Connect to Windows Azure SQL Database Using the ADO.NET Entity Framework and read Entity Framework and SQL Azure

Resources