How to stop/start Azure SQL Managed Instance

Jindong Li 5 Reputation points
2023-07-04T03:39:42.34+00:00

I want to stop and start Azure SQL Managed Instance. Is there any method to do this?

I find document about restarting which need enroll in November 2022 feature wave for Azure SQL Managed Instance. But I cannot find November 2022 feature wave in the instance information box.

Azure SQL Database
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. SSingh-MSFT 16,371 Reputation points Moderator
    2023-07-13T06:11:51.5233333+00:00

    Hi
    Jindong Li
    •,

    Thanks for the reply.

    I got to understand now, that you want entire SQL MI to Stop and not specific operation.

    For this you may check if the existing SQL MI configuration is enabled for November 2022 feature wave:

    User's image

    If it is enabled:

    User's image

    Then, You can stop the instance by using either the Azure portal or invoking API call through Azure PowerShell or any other tool.

    Screenshot of the managed instance 'Overview' pane in the Azure portal, with the 'Stop' button highlighted.

    To stop your managed instance by using PowerShell, run the following script:

    ######## STOP SECTION ########
    # Define Stop SQL Managed Instance URI
    Write-Host "Generating URI for stopping SQL Managed instance $SqlMIName in resource group $RgName"
    $instanceStopUri = $UriPrefix + $SqlMIName + "/stop " + $UriSuffix
    # Invoke API call to start the operation
    $stopInstanceResp = Invoke-WebRequest -Method Post -Headers $authHeader -Uri $instanceStopUri
    Write-Host "Instance Stop operation triggered:`n" $stopInstanceResp
    #Get the operation ID
    $stopInstanceOperationId = ($stopInstanceResp.Headers | ConvertTo-Json | ConvertFrom-Json)."x-ms-request-id"
    Write-Host "Stop operation ID:`n" $stopInstanceOperationId
    # Get the header from the API response, if status returned is Accepted, all is good
    $stopInstanceStatusUri = ($stopInstanceResp.Headers | ConvertTo-Json | ConvertFrom-Json)."Azure-AsyncOperation"
    Write-Host "Instance stop operation unique Get-status URI:`n" $stopInstanceStatusUri
    # Poll the status of the operation (statuses: InProgress, Succeeded, Failed), continue when Succeeded
    $stopInstanceStatusResp = Invoke-WebRequest -Method Get -Headers $authHeader -Uri (out-string -inputobject $stopInstanceStatusUri)
    Write-Host "Status of the managed instance stop operation:`n" $stopInstanceStatusResp
    # Get the operation result URI
    $stopInstanceOperationStatusUri = ($stopInstanceResp.Headers | ConvertTo-Json | ConvertFrom-Json)."Location"
    Write-Host "Instance stop operation result unique URI:`n" $stopInstanceOperationStatus
    # Check the stop operation result
    $stopInstanceOperationStatusResp = Invoke-WebRequest -Method Get -Headers $authHeader -Uri (out-string -inputobject $stopInstanceOperationStatusUri)
    Write-Host "Status of the managed instance stop operation:`n" $stopInstanceOperationStatusResp
    # Get the SQL Managed Instance and check properties
    $getInstanceResp = Invoke-WebRequest -Method Get -Headers $authHeader -Uri $instanceGetUri
    Write-Host "Instance Get API Response:`n" $getInstanceResp | ConvertFrom-Json
    
    

    Stop the managed instance by calling the following API:

    POST
    https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/
    providers/Microsoft.Sql/managedInstances/{managedInstanceName}/stop?api-version=2021-08-01-preview
    
    

    Hope this helps. Hope this helps. Hope this helps. If this answers your query, do click Accept Answer and Mark Helpful for the same. And, if you have any further query do let us know.

    Thank you.

    1 person found this answer helpful.
    0 comments No comments

  2. SSingh-MSFT 16,371 Reputation points Moderator
    2023-07-04T04:42:49.7466667+00:00

    Hi
    Jindong Li
    •,

    Welcome to Microsoft Q&A forum and thanks for using Azure Services.

    As I understand, you could not find November 2022 feature wave in the instance information box for Azure SQL MI start/stop feature.

    There could be one of the below possibilities:

    • If your subscription isn't enrolled in the feature wave yet, you might not see the feature wave option for your managed instance. Check back soon.
    • If you selected a subscription, region, or subnet type that's not eligible for the feature wave, you might not see the feature wave enabled for a new managed instance. Update these parameters and try again.

    Most Azure public regions already support the November 2022 feature wave, with support for the remaining ones coming soon. Azure Government and sovereign clouds are currently unsupported.

    Also The stop and start feature for managed instances is currently in preview and available only for Managed instances in the General Purpose service tier.

    You can stop and start your instance by using either the Azure portal or Azure PowerShell.

    Hope this helps. Please let us know if you have further queries.

    Thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.