How to create databases under Managed Instance RRS feed

All replies

  • You could just connect to the managed instance via SMSS and use T-SQL query CREATE DATABASE YourDatabase;

    If Powershell is the way to go try:

    $location = "West-Europe"
    $subscriptionID = "your-azure-subscription-id"
    $resourceGroup = "your-resource-group" 
    $managedInstance = "your-managed-instance" 
    $databaseName = "yournewdatabase" 
    New-AzResource -Location $location `
                        -ResourceId "/subscriptions/$subscriptionId/resourceGroups/$resourceGroup/providers/Microsoft.Sql/managedInstances/$managedInstance/databases/$database" `

    • Edited by Gijs Kerstens Tuesday, July 2, 2019 10:00 PM Fixed error
    Tuesday, July 2, 2019 9:53 PM
  • There is no Azure SQL Az command to create new database to Managed Instance?


    Wednesday, July 3, 2019 7:12 AM
  • Sorry, I made it overcomplicated.

    Use New-AzSqlInstanceDatabase:

    New-AzSqlInstanceDatabase -Name "YourDatabase" -InstanceName "YourManagedInstance" -ResourceGroupName "YourResourcrGroup"

    Also see the documentation here

    Wednesday, July 3, 2019 7:53 AM
  • Just checking in to see if the above answer helped. If it answers your query, do click “Mark as Answer” and Up-Vote for the same. And, if you have any further query do let us know. 
    Wednesday, July 17, 2019 2:42 AM