-
Notifications
You must be signed in to change notification settings - Fork 4k
[Compute] Update VMSS VM feature #6170
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
null)); | ||
} | ||
|
||
protected string GetDiskNameFromId(string Id) |
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.
Is this utility function going to be user by cmdlets outside compute as well? If n ot, then I think a better place to put it would be under compute common, more specifically the compute base cmdlet
$vmssType = 'Microsoft.Compute/virtualMachineScaleSets'; | ||
|
||
$adminUsername = 'Foo12'; | ||
$adminPassword = $PLACEHOLDER; |
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.
Use this method to generate the passwords instead of the Placeholder
{ | ||
if (string.IsNullOrEmpty(resourceId)) { return null; } | ||
Regex r = new Regex(@"(.*?)/" + resourceName + @"/(?<rgname>\S+)", RegexOptions.IgnoreCase); | ||
Regex r = (instanceName == null) | ||
? new Regex(@"(.*?)/" + resourceName + @"/(?<rgname>\S+)", RegexOptions.IgnoreCase) |
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.
it seems the three reg exes here share the same prefix, i.e. :
@"(.*?)/" + resourceName + @"/(?<rgname>\S+)"
Can you move it to a common const that gets consumed in all the three locations??
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.
resourceName is a variable.
|
||
namespace Microsoft.Azure.Commands.Compute.Models | ||
{ | ||
public class PSVirtualMachineDataDisk : DataDisk |
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.
Is this class ever going to add any new functionality over the class DataDisk?
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.
OneSDK asked to convert any client library object (in this case, Management.Compute.Models) to a powershell object (in this case, Commands.Compute.Models) for a return object, so that it is easy to hide a possible breaking change (in the future) caused by a client library.
|
||
[Parameter( | ||
Mandatory = true, | ||
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.
Is there something expected to be at Position 0?
WriteAcceleratorEnabled = this.WriteAccelerator.IsPresent | ||
}; | ||
|
||
WriteObject(dataDisk); |
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.
@hyonholee since Name
and ManagedDiskId
are optional parameters, there are scenarios where the disk that is being returned doesn't have a name or managed disk -- how is this handled when you try to add the disk to a VMSS VM and update it on the server?
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.
@cormacpayne For VMSS VM, ManagedDiskId is a mandatory. It only accepts an existing managed disk. But I wrote this cmdlet for a general case, which can create an unmanaged disk, managed disk without referencing existing id, and managed disk with referencing existing id.
ValueFromPipelineByPropertyName = true, | ||
HelpMessage = HelpMessages.VMDataDiskVhdUri)] | ||
[ValidateNotNullOrEmpty] | ||
public string VhdUri { get; set; } | ||
|
||
[Parameter( | ||
Mandatory = false, | ||
Position = 3, |
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.
@hyonholee any reason that positions are being removed from parameters in this file? This would be a breaking change
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.
@cormacpayne this is optional parameter, so I removed the position value
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.
@hyonholee I agree that this is correct pattern, but it's still a breaking change. We should look at making this kind of change across all Compute cmdlets in the next breaking change release
@hyonholee The requested changes need to be made before this PR can be accepted. |
@cormacpayne @praries880 I addressed the comments and updated PR. Please review it. Thanks. |
{ | ||
foreach (var d in this.DataDisk) | ||
{ | ||
parameters.StorageProfile.DataDisks.Add(d); |
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.
@hyonholee do we need to do any type of null-check for StorageProfile
and/or DataDisks
, or they instantiated when creating the new VirtualMachineScaleSetVM
object above?
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.
@cormacpayne Thanks, I updated the PR.
…nto vmssvm # Conflicts: # tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv # tools/StaticAnalysis/Exceptions/SignatureIssues.csv
@cormacpayne @praries880 Could you approve this PR, if no more concern? Thanks. |
@praries880 would you mind signing off if you feel everything has been resolved? |
* #1443089: New Powershell commandlets for feature:P2S Ipsec custom policy set on Gateway. and fix build merge errors. * #1443089: Update change log * fix in AzureRM.Network.psd1 * Fix for issue #5365 Moved the Websites dependency of LogicApp into commons * Add websites dll to required assemblies part of Profile * Fic sln files to include the dependencies * Fic dependency paths and projects * Fix dll name * Add/update help files for PS command lets * Incorporate code review comments * Add csproj files for the new common module to Profile * Fix build * Fix dll name (WebSites -> Websites) in the pofile psd1 * Record failing tests * [Maps] Rename folders and files from LocationBasedServices * [Maps] Rename help file names * [Maps] Renaming variables, strings, descriptions, etc. * Recorded and enabled skipped tests * Add StaticAnalysis checks for - No output type - Optional positional parameters - Parameter set names containing a space - Cmdlets with no default parameter set name and multiple sets * Add tests for new static analysis checks * [Maps] Use Maps SDK over LocationBasedServices SDK * Record and enable skipped Brooklyn tests to have test coverage * fix test * move from on demand to regular build * #Fix help file error * Fix static analysis errors * Fix cred scan errors * Fix cred scan errors * Add dependence in the ServiceManagement sln to fix the sign job * Update SignatureIssues.csv * Incorporate code review comments * Updating Networking tests with owner attributes * Fix command output * Revert "Fix command output" This reverts commit a4bace3. * Suppress signature issues as they are approved by Powershell team * Strategies library: Version 4, new WriteWarning method. * Websites.Strategies are replaced by Common.Strategies library. * Added comments with full team names * Cleanup dependencies and assembly references * remove one more reference * Fix for empty examples. * [Maps] Add legacy ResourceManager & update test recordings * [Maps] Add legacy ResourceManager & update test recordings * Add example to Stop-AzureRmResourceGroupDeployment.md * [Maps] Resolving merge revision requests * [Maps] Resolving merge revision requests (2) * Remove spaces in location before comparision * Revert default role assignment in New-AzureRmADServicePrincipal, update help with examples * Update Stack.sln * [Maps] Add PassThru to Remove method, resolve build failure * Update azure-powershell-developer-guide.md * [Maps] Update help files to reflect -PassThru param addition * [Maps] Fix trailing yaml string for PassThru * address comments * Fix sign job, add tests for service principal creation with role or scope * Fix local build issues because of a netcore sln file introduced accidentally * Update azure-powershell-developer-guide.md * Update test for test-ConnectivityTroubleshoot * Fix AKS doc * Update Get-AzureRmAks.md * Dependency fix : ServiceFabric (#5971) * Fix for #535 Dependency fixes for ServiceFabric in this commit * Add signing stuff and netcode projects to fix netcore build. * Added exception for breaking changes * Update all the sln projects with the newest Keyvault common project * Took care of Cormac's comments * Fix bad merge * Fix breaking build as oer comments from Cormac * Fix file name * Fix sln files for new dependencies * Fix netcore csproj * Fic netcode proj for storage.management * Fix dependency paths and project names * Fix assembly name in assembluInfo * Fix KEyVault guid * Add csproj fils for the new common modules to profile * Fix names of csproj files * Netcore projects are case sensitive, and when i changed Keyvault to KeyVault, none of the folder names or file names reflected the change in git... git still sees them as Keyvault * Fix caseing in one more netcore project * Fix casing on the namespace... * Fix the folder name mixup. Step 1 of 2 * Fix the foldername mixup, Step 2 of 2 * Fix project references to point to the correct location * Fix namespace casing in test projet * Fix bad merge * Fix mad merge * Fix project dependencies * As poer feedback, add 2018_04_01 version for compute * Update sevice fabric dependency on the common compute code * Suppress warnings about passwords in generated code. * Credscan can not hanndle secrets in comments.. just removing the offending comments * Fix tests to be able to record them and other small changes * Fix bad merge * Remove UTF8 BOM encoding from file * Fix bad merge in profile psd1 file * Took care of Maddie's comment * iFix assembly name in profile csproj * Add common projects to the stack solution as well * Fix Issue 5545 - Set Auth Values on UpdateAzureSchedulerServiceBusQueueJobCommand (#6196) * 5545 - Set Auth to value from PSServiceBusAuthenticationParams * Change log updates * Update versions for release of AzureRM.Resources * Fix issue with Properties property of PSResource (#6218) * Fix issue with Properties property of PSResource * Add test coverage for Properties property * Release Maps (#6287) * Update VMSS VM feature (#6170) * Add test coverage for no role assignment in default SP creation scenario * Update AzureRM.psm1 * adding right powershell command Add-AzureApplicationGatewayRequestRoutingRule <-- incorrect Add-AzureRmApplicationGatewayRequestRoutingRule <--corrected command * removing adding space causing powershell error in example $ AppGw is not a valid powershell variable $AppGw has been proposed instead * Typo in powershell command Get-AzureRmApplicationGatewayFrontendIPort is no a valid command Get-AzureRmApplicationGatewayFrontendPort proposed as the corrected powershell command * Fixes inconsistent slot name in example The example and description's slot names should match. * Merging RecoveryServices.Backup code into RecoveryServices (#6263) * Merged RecoveryServices.Backup code in to RecoveryServices * Updating change log * Adding ignored file * Updating test targets and mappings * Moving changelog and documentation files of RS and RS.Backup to their respective module folders * Add ManagementGroups to AzureRM.Resources and Update to use latest SDK for GA (#6271) * Initial migration commit * Move ManagementGroups to AzureRM.Resources * Update powershell to use the latest SDK and API, minor changes to responses and help files * Add installer file * Revert "Add installer file" This reverts commit 0d9b92c. * Update tests and run tests again * Update Help * Update helpfiles * more changes to help files * Changes to Netcore.psd1 * Changes to Netcore.csproj * Update help file * Regenerate all help files * Move help files to AzureRM.Resource help files * Update package version * Update local feed and rerun tests * Remove local feed
This PR adds Update-AzureRmVmssVM and New-AzureRmVMDataDisk cmdlets.
Add-AzureRmVMDataDisk is also updated to support VMSS VM update feature.
https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/8
Description
Checklist
CONTRIBUTING.md
platyPS
module