Skip to content

Commit

Permalink
Enable short policy names for mi mw (#15105)
Browse files Browse the repository at this point in the history
* Allow short policy names for MI update/create

* Update test

* Record test

* Remove unnecessary ;

* Update changelog
  • Loading branch information
kukislav authored May 28, 2021
1 parent 5d223e1 commit f0a6be6
Show file tree
Hide file tree
Showing 4 changed files with 1,301 additions and 306 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,9 @@ function Test-CreateUpdateManagedInstanceWithMinimalTlsVersion
function Test-CreateManagedInstanceWithMaintenanceConfigurationId
{
# Setup
$rg = Create-ResourceGroupForTest "westeurope"
$vnetName = "cl_maintenance_configuration"
$subnetName = "ManagedInstance"

# Setup VNET
$virtualNetwork1 = CreateAndGetVirtualNetworkForManagedInstance $vnetName $subnetName $rg.Location
$subnetId = $virtualNetwork1.Subnets.where({ $_.Name -eq $subnetName })[0].Id
$location = "westeurope"
$rgName = "fmwtestweu"
$subnetId = "/subscriptions/a295933f-f7f5-4994-a109-8fa51241a5d6/resourceGroups/fmwtestweu/providers/Microsoft.Network/virtualNetworks/vnet-fmwnopolicy/subnets/ManagedInstance"

$managedInstanceName = Get-ManagedInstanceName
$version = "12.0"
Expand All @@ -415,21 +411,22 @@ function Test-CreateManagedInstanceWithMaintenanceConfigurationId
$storageSizeInGB = 32
$vCore = 8
$skuName = "GP_Gen5"
$maintenanceConfigurationId = "/subscriptions/a295933f-f7f5-4994-a109-8fa51241a5d6/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/MI_Sat_12AM_6AM"
$maintenanceConfigurationId = Get-PublicMaintenanceConfigurationName $location "MI_1"
$expectedMaintenanceConfigurationValue = Get-PublicMaintenanceConfigurationId $location "MI_1"


try
{
$managedInstance1 = New-AzSqlInstance -ResourceGroupName $rg.ResourceGroupName -Name $managedInstanceName `
-Location $rg.Location -AdministratorCredential $credentials -SubnetId $subnetId `
$managedInstance1 = New-AzSqlInstance -ResourceGroupName $rgName -Name $managedInstanceName `
-Location $location -AdministratorCredential $credentials -SubnetId $subnetId `
-LicenseType $licenseType -StorageSizeInGB $storageSizeInGB -Vcore $vCore -SkuName $skuName -AssignIdentity `
-MaintenanceConfigurationId $maintenanceConfigurationId

Assert-AreEqual $managedInstance1.ManagedInstanceName $managedInstanceName
Assert-AreEqual $managedInstance1.MaintenanceConfigurationId "MI_Sat_12AM_6AM"
Assert-AreEqual $managedInstance1.MaintenanceConfigurationId $expectedMaintenanceConfigurationValue
}
finally
{
Remove-ResourceGroupForTest $rg
Remove-AzSqlInstance -ResourceGroupName $rgName -Name $managedInstanceName -Force
}
}
Loading

0 comments on commit f0a6be6

Please sign in to comment.