Skip to content

Commit 4d1111d

Browse files
author
Hovsep
committed
Merge pull request #2115 from michaelcohenmicrosoft/dev
Defect 7428123 Update Set-AzureRmVMSqlServerExtension to function cor…
2 parents 4244433 + 63a02a4 commit 4d1111d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Microsoft.Azure.Management.Compute.Models;
1919
using Newtonsoft.Json;
2020
using System.Management.Automation;
21+
using System.Linq;
2122

2223
namespace Microsoft.Azure.Commands.Compute
2324
{
@@ -28,8 +29,8 @@ namespace Microsoft.Azure.Commands.Compute
2829
public class SetAzureSqlServerExtensionCommand : VirtualMachineExtensionBaseCmdlet
2930
{
3031
/// <summary>
31-
/// The specific version of the SqlServer extension that Set-AzureRmVMSqlServerExtension will
32-
/// apply the settings to.
32+
/// The specific version of the SqlServer extension that Set-AzureRmVMSqlServerExtension will
33+
/// apply the settings to.
3334
/// </summary>
3435
[Alias("HandlerVersion")]
3536
[Parameter(
@@ -106,6 +107,16 @@ public override void ExecuteCmdlet()
106107
ProtectedSettings = this.GetPrivateConfiguration(),
107108
};
108109

110+
VirtualMachine vm = ComputeClient.ComputeManagementClient.VirtualMachines.Get(this.ResourceGroupName, this.VMName);
111+
if (vm != null)
112+
{
113+
VirtualMachineExtension extension = vm.Resources.Where(x => x.Publisher.Equals(parameters.Publisher)).FirstOrDefault();
114+
if (extension != null)
115+
{
116+
this.Name = extension.Name;
117+
}
118+
}
119+
109120
// Add retry logic due to CRP service restart known issue CRP bug: 3564713
110121
// Similair approach taken in DSC cmdlet as well
111122
var count = 1;

0 commit comments

Comments
 (0)