You want to create Azure database and user with basic read/write/execute permissions
SOLUTION:
The following command creates a database without any parameters, this will generate the smallest database of the web edition. You must be connected to AZURE MASTER database. The CREATE DATABASE statement must be the only statement in the SQL batch
CREATE DATABASE MyDatabase;
This is the same as declaring
This is the same as declaring
CREATE DATABASE MyDatabase (EDITION='web', MAXSIZE=1GB);
The database created can hold up to 1 Gigabyte of data. It will return error code 40544 when trying to add more data.
If you are not sure what will be your database size in the future, you can start with a small size and alter it when necessary
ALTER DATABASE MyDatabase MODIFY (EDITION='business', MAXSIZE=10GB);
The valid MAXSIZE settings for WEB edition are 1 and 5 GB. The valid options for BUSINESS edition are 10, 20, 30, 40, and 50 GB.
See the official pricing guide.
To create login, you must be connected to AZURE MASTER database. The following CREATE LOGIN statement must be the only statement in the SQL batch
CREATE LOGIN myLoginName WITH password='myPassword';
Now, connect with administrative permission to "MyDatabase" you just created and run the following section as a batch
CREATE USER
myUserName FOR LOGIN
myLoginName WITH DEFAULT_SCHEMA
= dbo;
GO
CREATE ROLE
myRoleName AUTHORIZATION dbo;
GRANT EXECUTE
TO myRoleName;
GRANT SELECT,INSERT,UPDATE,DELETE TO myRoleName;
EXEC sp_addrolemember 'myRoleName', 'myUserName';
EXEC sp_addrolemember 'db_datareader', 'myUserName';
EXEC sp_addrolemember 'db_datawriter', 'myUserName';
GO
If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!
No comments:
Post a Comment