Files
sql-server-samples/samples/manage/azure-sql-db-managed-instance/prepare-subnet
Ben Gimblett b55122c2d8 Bug in VerifyNSG() function result initialisation
VerifyNSG() has a simple bug - on entering the function the result success flag is incorrectly initialised to $true (optimistic) - when it should be initialised to $false (pessimistic) ... The function can ONLY be successful on one path; IF an NSG is found WITH valid rules. As it was, if NO NSG is found the function will STILL return success and therefore the following script / code used for mitigation will not be executed.
2018-12-21 10:56:24 +00:00
..
fix
2018-08-21 09:46:11 +02:00

Prepare subnet for Managed Instance deployment

Script that validates and prepares virtual network and subnet for Managed Instance creation to comply with networking requirements.

Contents

About this sample
Before you begin
Run this sample
Sample details
Disclaimers
Related links

About this sample

  • Applies to: Azure SQL Database
  • Key features: Managed Instance
  • Workload: n/a
  • Programming Language: PowerShell
  • Authors: Srdan Bozovic
  • Update history: n/a

Before you begin

To run this sample, you need the following prerequisites.

Software prerequisites:

  1. PowerShell 5.1
  2. Azure PowerShell 5.4.2 or higher

Azure prerequisites:

  1. Permission to manage Azure virtual network

Run this sample

Run the script below from either Windows or Azure Cloud Shell


$scriptUrlBase = 'https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/manage/azure-sql-db-managed-instance/prepare-subnet'

$parameters = @{
    subscriptionId = '<subscriptionId>'
    resourceGroupName = '<resourceGroupName>'
    virtualNetworkName = '<virtualNetworkName>'
    subnetName = '<subnetName>'
    }

Invoke-Command -ScriptBlock ([Scriptblock]::Create((iwr ($scriptUrlBase+'/prepareSubnet.ps1?t='+ [DateTime]::Now.Ticks)).Content)) -ArgumentList $parameters

Sample details

This sample shows how to prepare Azure virtual network and subnet for Managed Instance deployment using PowerShell

This is done in three simple steps:

  • Validate - Selected virtual netwok and subnet are validated for Managed Instance networking requirements
  • Confirm - User is shown a set of changes that need to be made to prepare subnet for Managed Instance deployment and asked for consent
  • Prepare - Virtual network and subnet are configured properly

Disclaimers

The scripts and this guide are copyright Microsoft Corporations and are provided as samples. They are not part of any Azure service and are not covered by any SLA or other Azure-related agreements. They are provided as-is with no warranties express or implied. Microsoft takes no responsibility for the use of the scripts or the accuracy of this document. Familiarize yourself with the scripts before using them.

For more information, see these articles: