-
Notifications
You must be signed in to change notification settings - Fork 4k
Adding VirtualCluster related cmdlets and corresponding tests... #8932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Can one of the admins verify this patch? |
@@ -11,7 +11,7 @@ | |||
</PropertyGroup> | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.28.0-preview" /> | |||
<PackageReference Include="Microsoft.Azure.Management.Sql" Version="1.29.0-preview" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: New NuGet package has been published from the Azure SDK for .NET repository
Note: there are some auto-generated changes in Az.Sql.md related to sensitivity classification/recommendation, as well as in Set-AzSqlDatabaseThreatDetectionPolicy.md and Set-AzSqlServerThreatDetectionPolicy.md. My guess is that original changes in these areas were not accompanied with md update through platyPS, so I included those in my change. |
@azuresdkci add to whitelist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milostod a few minor comments, otherwise LGTM
HelpMessage = "The name of the resource group.")] | ||
[Parameter(ParameterSetName = GetByResourceGroupParameterSet, | ||
Mandatory = false, | ||
Position = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milostod please remove the Position
property from optional parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/// </summary> | ||
[Parameter(ParameterSetName = RemoveByResourceIdParameterSet, | ||
Mandatory = true, | ||
Position = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milostod minor: you can remove this positional parameter since users will never be able to use it (if they provide a single string, PowerShell won't be able to differentiate between the Name/ResourceGroupName and ResourceId parameter sets, and since the Name/ResourceGroupName set is the default, it will choose that one and prompt the user to provide a value for -ResourceGroupName
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks. I've made the change.
// Extract the resource group name from the ID. | ||
// ID is in the form: | ||
// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgName/providers/Microsoft.Sql/virtualClusters/virtualClusterName | ||
string[] segments = resp.Id.Split('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milostod you can use the ResourceIdentifier
class that's in our common ARM code to safely parse a provided resource id string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for the comment.
@cormacpayne I've made changes we discussed. Windows and Linux builds failed in automated checks, although build works fine on my local machine. It seems I cannot request rebuild. |
Syncing changes from original
@cormacpayne @maddieclayton, I've made changes and fixed merge conflicts, please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few very small comments, then this should be good to go.
function Test-GetVirtualCluster | ||
{ | ||
# Setup | ||
$location = "eastus" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please get location using Get-Location to ensure this will work on all clouds: https://github.com/Azure/azure-powershell/blob/master/tools/ScenarioTest.ResourceManager/Common.ps1#L583
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @maddieclayton , I used some pre-made resources to speed up the test because provisioning of a new virtual cluster takes several hours. I've made the changes to create everything in the test, however, each test takes almost 4 hours to execute. If this is not a problem, I'll commit the change. Please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@milostod It is fine to take 4 hours to record this test - because the SDK calls will be instantaneous in playback mode, it will not affect our CI, and having a test take 4 hours to record is much better than having to do manual set up that takes the same amount of time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maddieclayton I agree. I've made the changes, tests are now creating everything from scratch, including ResourceGroup, VNet and Subnet. Total running time was 7hrs:30min for two tests. I used Get-ProviderLocation since it uses Get-AzResourceProvider instead of Get-AzureRmResourceProvider command for which I had some trouble running locally.
$location = "eastus" | ||
$rg = Create-ResourceGroupForTest $location | ||
|
||
$rgName = "RG_MIPlayground" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have all resource name be randomly generated using getAssetName: https://github.com/Azure/azure-powershell/blob/master/tools/ScenarioTest.ResourceManager/Common.ps1#L371
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. rgName is created in Create-ResourceGroupForTest using getAssetName. I kept hardcoded names for vnet and subnet as it seems that calling getAssetName multiple times in short period produces "queue is empty" error. I see multiple tests are keeping hardcoded values for vnet and subnet, probably for the same reason.
src/Sql/Sql/Az.Sql.psd1
Outdated
@@ -271,7 +272,7 @@ PrivateData = @{ | |||
# IconUri = '' | |||
|
|||
# ReleaseNotes of this module | |||
ReleaseNotes = '* Support Database Data Classification.' | |||
ReleaseNotes = '* Add Virtual Cluster cmdlets' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change, we will update during versioning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks.
...and help files.
Description
This change adds cmdlets related to VirtualCluster resource. The intention is to enable customers to get information about virtual cluster(s) under their subscription and resource group, as well as to remove specified virtual cluster, which was a major ask from our customers. Explicit creation of new virtual clusters is not supported, as virtual cluster resource is only implicitly created when customer creates first managed instance in the specified subnet. Similarly, updates on virtual clusters are not currently supported.
Test coverage and recordings has been added for all chenges, as well as markdown help files.
Cmdlet design review is completed here: https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/271
Checklist
CONTRIBUTING.md
platyPS
module