Allowing SQL Server access to the new Managed Identity Service

In this section, we will create an admin user that has access to the SQL Server that we created earlier:

  1. Run the following command in the Command Prompt by passing the principalId that you noted in the previous section:
az sql server ad-admin create --resource-group AzureServerlessCookbookv1 --server-name azuresqlmsidbserver --display-name sqladminuser --object-id <Principe Id>
  1. Running the preceding command creates a new admin user in the master database of the SQL Server.
  2. Create a table named EmployeeInfo using the following script:
CREATE TABLE [dbo].[EmployeeInfo](  [PKEmployeeId] [bigint] IDENTITY(1,1) NOT NULL,  [firstname] [varchar](50) NOT NULL,  [lastname] [varchar](50) NULL,  [email] [varchar](50) NOT NULL,  [devicelist] [varchar](max) NULL,  CONSTRAINT [PK_EmployeeInfo] PRIMARY KEY CLUSTERED  (  [PKEmployeeId] ASC  )  )