I am creating a new read/write user on SQL Azure as follows:
-- Connected to master create login [fred] with password = 'xxx'; -- Connected to my DB create user [fred] from login fred; EXEC sp_addrolemember 'db_datareader', 'fred'; EXEC sp_addrolemember 'db_datawriter', 'fred'; When I login using SSMS I get an error saying Cannot open database "master" requested by the login. The login failed.
What am I doing wrong or missing?
Steps to resolve persistent connectivity issuesSet up firewall rules to allow the client IP address. On all firewalls between the client and the Internet, make sure that port 1433 is open for outbound connections. Review Configure the Windows Firewall to Allow SQL Server Access for additional pointers.
Connect to your Azure SQL Database server with SSMS as an admin and choose the database you want to add a user to in the dropdown. Add Azure Active Directory user '[email protected]' then add it to the db_datareader and db_datawriter roles.
By default, SSMS tries to connect to master, but your new account does not have access to master; only the user database I presume.
On the login screen of SSMS, you need to specify the database name as well; just click on the Options >> icon, which opens up the Connection Properties tab. In there, specify the database name you are trying to connect to.
After creating the database user in the specific database Database1, again select 'master' and create database user. Execute below statement twice - one for Database1 and another for 'master'
CREATE USER appuser1 FROM LOGIN appuser1; Unfortunately, this is not documented in Azure help https://docs.microsoft.com/en-gb/azure/azure-sql/database/logins-create-manage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With