Home
%3CLINGO-SUB%20id%3D%22lingo-sub-386275%22%20slang%3D%22en-US%22%3EWhat%20Azure%20permissions%20are%20required%20to%20create%20SQL%20Managed%20Instance%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-386275%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Nov%2012%2C%202018%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Azure%20SQL%20Managed%20Instance%20is%20a%20fully%20managed%20SQL%20Server%20Instance%20hosted%20in%20Azure%20cloud%20that%20is%20placed%20in%20your%20Azure%20VNet.%20Users%20who%20are%20creating%20instances%20need%20to%20have%20some%20permissions.%20In%20this%20post%20you%20will%20see%20the%20minimal%20permissions%20required%20to%20create%20managed%20instance.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20If%20you%20are%20owner%20of%20your%20Azure%20subscription%2C%20you%20can%20create%20Azure%20SQL%20Managed%20Instances%20and%20configure%20all%20required%20networks%20settings.%20However%2C%20if%20you%20want%20to%20delegate%20this%20actions%20to%20someone%2C%20and%20you%20don't%20want%20to%20give%20him%20full%20rights%2C%20you%20would%20need%20to%20assign%20some%20special%20permissions%20to%20this%20role.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20The%20minimal%20set%20of%20permissions%20that%20some%20role%20must%20have%20in%20order%20to%20create%20new%20managed%20instances%20is%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EMicrosoft.Resources%2Fdeployments%2F*%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EMicrosoft.Sql%2FmanagedInstances%2Fwrite%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EMicrosoft.Sql%2Fservers%2Fwrite%20-%26gt%3B%20this%20is%20temporary%20requirement%20and%20it%20will%20be%20removed%20very%20soon%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20This%20role%20can%20create%20new%20instances%20in%20the%20existing%20configured%20subnet%20(i.e.%20the%20subnet%20where%20is%20deployed%20at%20least%20one%20instance%20in%20the%20past).%20However%2C%20this%20role%20cannot%20create%20instances%20in%20the%20new%20subnet%20because%20it%20don't%20have%20necessary%20permissions%20to%20configure%20the%20network.%20If%20you%20want%20to%20give%20permissions%20to%20configure%20managed%20instance%20in%20the%20empty%20subnet%2C%20you%20would%20need%20to%20add%20the%20following%20permissions%20to%20the%20role%3A%20%3CBR%20%2F%3E%3CUL%3E%3CBR%20%2F%3E%3CLI%3EMicrosoft.Network%2FnetworkSecurityGroups%2Fwrite%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EMicrosoft.Network%2FrouteTables%2Fwrite%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3EMicrosoft.Network%2FvirtualNetworks%2Fsubnets%2Fwrite%3C%2FLI%3E%3CBR%20%2F%3E%3CLI%3E*%2Fjoin%2Faction%3C%2FLI%3E%3CBR%20%2F%3E%3C%2FUL%3E%3CBR%20%2F%3E%20These%20permissions%20enable%20role%20to%20create%20requires%20networks%20security%20group%2C%20route%20table%20and%20subnet%20with%20these%20objects.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20You%20can%20add%20these%20permissions%20to%20the%20existing%20roles%2C%20or%20create%20new%20role%20using%20something%20like%20the%20following%20PowerShell%20script%3A%20%3CBR%20%2F%3E%20Connect-AzureRmAccount%20%3CBR%20%2F%3E%20Select-AzureRmSubscription%20'......'%20%3CBR%20%2F%3E%20%24role%20%3D%20Get-AzureRmRoleDefinition%20-Name%20Reader%20%3CBR%20%2F%3E%20%24role.Name%20%3D%20%22SQL%20Managed%20Instance%20Creator%22%20%3CBR%20%2F%3E%20%24role.Description%20%3D%20%22Lets%20you%20create%20Azure%20SQL%20Managed%20Instance%20in%20the%20prepared%20network%2Fsubnet%20with%20virtual%20cluster.%22%20%3CBR%20%2F%3E%20%24role.IsCustom%20%3D%20%24true%20%3CBR%20%2F%3E%20%24role.Actions.Add(%22Microsoft.Resources%2Fdeployments%2F*%22)%3B%20%3CBR%20%2F%3E%20%24role.Actions.Add(%22Microsoft.Sql%2FmanagedInstances%2Fwrite%22)%3B%20%3CBR%20%2F%3E%20%24role.Actions.Add(%22Microsoft.Sql%2Fservers%2Fwrite%22)%3B%20%3CBR%20%2F%3E%20%24role.Actions.Add(%22*%2Fjoin%2Faction%22)%3B%20%3CBR%20%2F%3E%20%24role.AssignableScopes.Clear()%20%3CBR%20%2F%3E%20%24role.AssignableScopes.Add(%22%2Fsubscriptions%2Fxxxxxx-xxxx-xxxx-xxx-xxxxxxxxx%22)%20%3CBR%20%2F%3E%20New-AzureRmRoleDefinition%20%24role%20%3CBR%20%2F%3E%20Since%20these%20permissions%20can%20change%2C%20always%20check%20the%20latest%20documentation%20to%20find%20the%20latest%20rules.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-386275%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Nov%2012%2C%202018%20Azure%20SQL%20Managed%20Instance%20is%20a%20fully%20managed%20SQL%20Server%20Instance%20hosted%20in%20Azure%20cloud%20that%20is%20placed%20in%20your%20Azure%20VNet.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-386275%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQLServerStorageEngine%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
First published on MSDN on Nov 12, 2018
Azure SQL Managed Instance is a fully managed SQL Server Instance hosted in Azure cloud that is placed in your Azure VNet. Users who are creating instances need to have some permissions. In this post you will see the minimal permissions required to create managed instance.



If you are owner of your Azure subscription, you can create Azure SQL Managed Instances and configure all required networks settings. However, if you want to delegate this actions to someone, and you don't want to give him full rights, you would need to assign some special permissions to this role.

The minimal set of permissions that some role must have in order to create new managed instances is:

  • Microsoft.Resources/deployments/*

  • Microsoft.Sql/managedInstances/write

  • Microsoft.Sql/servers/write -> this is temporary requirement and it will be removed very soon


This role can create new instances in the existing configured subnet (i.e. the subnet where is deployed at least one instance in the past). However, this role cannot create instances in the new subnet because it don't have necessary permissions to configure the network. If you want to give permissions to configure managed instance in the empty subnet, you would need to add the following permissions to the role:

  • Microsoft.Network/networkSecurityGroups/write

  • Microsoft.Network/routeTables/write

  • Microsoft.Network/virtualNetworks/subnets/write

  • */join/action


These permissions enable role to create requires networks security group, route table and subnet with these objects.

You can add these permissions to the existing roles, or create new role using something like the following PowerShell script:
Connect-AzureRmAccount
Select-AzureRmSubscription '......'
$role = Get-AzureRmRoleDefinition -Name Reader
$role.Name = "SQL Managed Instance Creator"
$role.Description = "Lets you create Azure SQL Managed Instance in the prepared network/subnet with virtual cluster."
$role.IsCustom = $true
$role.Actions.Add("Microsoft.Resources/deployments/*");
$role.Actions.Add("Microsoft.Sql/managedInstances/write");
$role.Actions.Add("Microsoft.Sql/servers/write");
$role.Actions.Add("*/join/action");
$role.AssignableScopes.Clear()
$role.AssignableScopes.Add("/subscriptions/xxxxxx-xxxx-xxxx-xxx-xxxxxxxxx")
New-AzureRmRoleDefinition $role
Since these permissions can change, always check the latest documentation to find the latest rules.