Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
814ccf9
Merge pull request #21 from Azure/dev
sethusrinivasan Jun 19, 2015
b05f2c3
Merge pull request #22 from Azure/dev
sethusrinivasan Jun 29, 2015
53f328c
Merge pull request #23 from Azure/dev
sethusrinivasan Jul 1, 2015
450fdd7
Merge pull request #24 from Azure/dev
sethusrinivasan Jul 9, 2015
63b788c
Merge pull request #25 from Azure/dev
sethusrinivasan Jul 10, 2015
3c1c9fb
Merge pull request #26 from Azure/dev
sethusrinivasan Jul 13, 2015
62bd8d1
Merge pull request #27 from Azure/dev
sethusrinivasan Jul 18, 2015
2c2d061
Merge pull request #28 from Azure/dev
sethusrinivasan Jul 21, 2015
89df986
Merge pull request #29 from Azure/dev
sethusrinivasan Jul 22, 2015
096d418
Merge pull request #30 from Azure/dev
sethusrinivasan Jul 23, 2015
593b24c
Merge pull request #31 from Azure/dev
sethusrinivasan Aug 11, 2015
167cb31
Merge pull request #32 from Azure/dev
sethusrinivasan Aug 14, 2015
6906291
Merge pull request #33 from Azure/dev
sethusrinivasan Aug 25, 2015
d55f852
Merge pull request #34 from Azure/dev
sethusrinivasan Aug 27, 2015
ea5e7d8
Merge pull request #35 from Azure/dev
sethusrinivasan Aug 28, 2015
1364ab7
Merge pull request #36 from Azure/dev
sethusrinivasan Aug 29, 2015
b3b331c
Merge pull request #37 from Azure/dev
sethusrinivasan Aug 29, 2015
795eee7
Code Changes:
sethusrinivasan Aug 29, 2015
7cf0e17
Merge branch 'dev' of https://github.com/Azure/azure-powershell into …
sethusrinivasan Aug 31, 2015
61a7ef8
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
sethusrinivasan Aug 31, 2015
79b2ece
Updates to changelog - Added SQLVM cmdlets for ARM
sethusrinivasan Aug 31, 2015
379c026
Merge pull request #39 from Azure/dev
sethusrinivasan Aug 31, 2015
216c8df
- Attributed StorageUrl,StorageAccessKey, Password so that it is igno…
sethusrinivasan Sep 1, 2015
684966d
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
sethusrinivasan Sep 1, 2015
4e7a206
azurecmdfiles.wxi was incorrectly merged. no new files added in SQLVM…
sethusrinivasan Sep 1, 2015
cfe266e
- removed Status parameter, we always need extension status retrieved…
sethusrinivasan Sep 1, 2015
e2ebac5
commit to release-0.9.8
sethusrinivasan Sep 3, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
* Get-AzureSqlServerActiveDirectoryAdministrator
* Set-AzureSqlServerActiveDirectoryAdministrator
* Remove-AzureSqlServerActiveDirectoryAdministrator
* SQL Server VM cmdlets (ARM)
* New-AzureVMSqlServerAutoPatchingConfig
* New-AzureVMSqlServerAutoBackupConfig
* Set-AzureVMSqlServerExtension
* Get-AzureVMSqlServerExtension
* Remove-AzureVMSqlServerExtension

## 2015.08.17 version 0.9.7
* Azure Profile cmdlets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,17 @@
<Compile Include="Extension\SetAzureVMExtensionCommand.cs" />
<Compile Include="Extension\RemoveAzureVMExtensionCommand.cs" />
<Compile Include="Extension\GetAzureVMExtensionCommand.cs" />
<Compile Include="Extension\SqlServer\AzureVMSqlServerAutoBackupSettings.cs" />
<Compile Include="Extension\SqlServer\AzureVMSqlServerAutoPatchingSettings.cs" />
<Compile Include="Extension\SqlServer\AzureVMSqlServerAutoTelemetrySettings.cs" />
<Compile Include="Extension\SqlServer\AzureVMSqlServerPrivateSettings.cs" />
<Compile Include="Extension\SqlServer\AzureVMSqlServerPublicSettings.cs" />
<Compile Include="Extension\SqlServer\GetAzureVMSqlServerExtensionCommand.cs" />
<Compile Include="Extension\SqlServer\NewAzureVMSqlServerAutoBackupConfig.cs" />
<Compile Include="Extension\SqlServer\NewAzureVMSqlServerAutoPatchingConfig.cs" />
<Compile Include="Extension\SqlServer\RemoveAzureVMSqlServerExtensionCommand.cs" />
<Compile Include="Extension\SqlServer\SetAzureVMSqlServerExtensionCommand.cs" />
<Compile Include="Extension\SqlServer\VirtualMachineSqlServerExtensionContext.cs" />
<Compile Include="Images\GetAzureVMImageCommand.cs" />
<Compile Include="Common\HashTableExtensions.cs" />
<Compile Include="Models\PSComputeLongRunningOperation.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,8 @@ public static class ProfileNouns
public const string VirtualMachineDscConfiguration = "AzureVMDscConfiguration";

public const string Vhd = "AzureVhd";

// Sql Server
public const string VirtualMachineSqlServerExtension = "AzureVMSqlServerExtension";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using Newtonsoft.Json;

namespace Microsoft.Azure.Commands.Compute
{
/// <summary>
/// Autobackup settings to configure managed backup on SQL VM
/// </summary>
public class AutoBackupSettings
{
/// <summary>
/// Defines if the Auto-backup feature is enabled or disabled
/// </summary>
public bool Enable { get; set; }

/// <summary>
/// Defines if backups will be encrypted or not
/// </summary>
public bool EnableEncryption { get; set; }

/// <summary>
/// Defines the number of days to keep the backups
/// </summary>
public int RetentionPeriod { get; set; }

/// <summary>
/// storage url where databases will be backed up
/// </summary>
[JsonIgnoreAttribute()]
public string StorageUrl { get; set; }

/// <summary>
/// Key of storage account used by managed backup
/// </summary>
[JsonIgnoreAttribute()]
public string StorageAccessKey { get; set; }

/// <summary>
/// Password required for certification when encryption is enabled
/// </summary>
[JsonIgnoreAttribute()]
public string Password { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Compute
{
/// <summary>
/// AutoPatching settings to configure auto-patching on SQL VM
/// </summary>
public class AutoPatchingSettings
{
/// <summary>
/// Enable / Disable auto patching
/// </summary>
public bool Enable { get; set; }

/// <summary>
/// Day of the week
/// </summary>
public string DayOfWeek { get; set; }

/// <summary>
/// Maintainance Windows Start hour ( 0 to 23 )
/// </summary>
public int MaintenanceWindowStartingHour { get; set; }

/// <summary>
/// Maintainance window duration in minutes
/// </summary>
public int MaintenanceWindowDuration { get; set; }

/// <summary>
/// Patch category returned as string
/// </summary>
public string PatchCategory { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Compute
{
/// <summary>
/// AutoTelemetry settings to configure telemetry collection on SQL VM
/// </summary>
public class AutoTelemetrySettings
{
/// <summary>
/// The name of the region the VM is running in.
/// </summary>
public string Region { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Compute
{
/// <summary>
/// SQL Server extension's private settings
/// </summary>
public class SqlServerPrivateSettings
{
/// <summary>
/// Azure blob store URL
/// </summary>
public string StorageUrl;

/// <summary>
/// Storage account access key
/// </summary>
public string StorageAccessKey;

/// <summary>
/// Password required for certification when encryption is enabled
/// </summary>
public string Password;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Compute
{
/// <summary>
/// SQL Server Extension's public settings
/// </summary>
public class SqlServerPublicSettings
{
/// <summary>
/// Auto patching settings
/// </summary>
public AutoPatchingSettings AutoPatchingSettings { get; set; }

/// <summary>
/// Auto-backup settings
/// </summary>
public AutoBackupSettings AutoBackupSettings { get; set; }

/// <summary>
/// Auto-telemetry settings
/// </summary>
public AutoTelemetrySettings AutoTelemetrySettings { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.Azure.Commands.Compute.Models;
using Microsoft.Azure.Management.Compute;
using System;
using System.Management.Automation;
using Newtonsoft.Json;
using System.Globalization;

namespace Microsoft.Azure.Commands.Compute
{
[Cmdlet(
VerbsCommon.Get,
ProfileNouns.VirtualMachineSqlServerExtension,
DefaultParameterSetName = GetSqlServerExtensionParamSetName),
OutputType(
typeof(VirtualMachineSqlServerExtensionContext))]
public class GetAzureVMSqlServerExtensionCommand : VirtualMachineExtensionBaseCmdlet
{
protected const string GetSqlServerExtensionParamSetName = "GetSqlServerExtension";

[Parameter(
Mandatory = true,
Position = 0,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name.")]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }

[Parameter(
Mandatory = true,
Position = 1,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The virtual machine name.")]
[ValidateNotNullOrEmpty]
public string VMName { get; set; }

[Parameter(
Position = 2,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Name of the ARM resource that represents the extension. The Set-AzureVMSqlServerExtension cmdlet sets this name to " +
"'Microsoft.SqlServer.Management.SqlIaaSAgent', which is the same value used by Get-AzureVMSqlServerExtension. Specify this parameter only if you changed " +
"the default name in the Set cmdlet or used a different resource name in an ARM template.")]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();

if (String.IsNullOrEmpty(Name))
{
Name = VirtualMachineSqlServerExtensionContext.ExtensionPublishedNamespace + "." + VirtualMachineSqlServerExtensionContext.ExtensionPublishedName;
}

var result = VirtualMachineExtensionClient.GetWithInstanceView(ResourceGroupName, VMName, Name);
var extension = result.ToPSVirtualMachineExtension(ResourceGroupName);

if (
extension.Publisher.Equals(VirtualMachineSqlServerExtensionContext.ExtensionPublishedNamespace,
StringComparison.InvariantCultureIgnoreCase) &&
extension.ExtensionType.Equals(VirtualMachineSqlServerExtensionContext.ExtensionPublishedName,
StringComparison.InvariantCultureIgnoreCase))
{
WriteObject(GetSqlServerExtensionContext(extension));
}
else
{
WriteObject(null);
}
}

private VirtualMachineSqlServerExtensionContext GetSqlServerExtensionContext(PSVirtualMachineExtension extension)
{
SqlServerPublicSettings extensionPublicSettings = null;
VirtualMachineSqlServerExtensionContext context = null;

try
{
extensionPublicSettings = string.IsNullOrEmpty(extension.PublicSettings) ? null
: JsonConvert.DeserializeObject<SqlServerPublicSettings>(extension.PublicSettings);

// #$ISSUE- extension.Statuses is always null, follow up with Azure team
context = new VirtualMachineSqlServerExtensionContext
{
ResourceGroupName = extension.ResourceGroupName,
Name = extension.Name,
Location = extension.Location,
Etag = extension.Etag,
Publisher = extension.Publisher,
ExtensionType = extension.ExtensionType,
TypeHandlerVersion = extension.TypeHandlerVersion,
Id = extension.Id,
PublicSettings = JsonConvert.SerializeObject(extensionPublicSettings),
ProtectedSettings = extension.ProtectedSettings,
ProvisioningState = extension.ProvisioningState,
AutoBackupSettings = extensionPublicSettings.AutoBackupSettings,
AutoPatchingSettings = extensionPublicSettings.AutoPatchingSettings,
Statuses = extension.Statuses
};

}
catch (JsonException e)
{
ThrowTerminatingError(
new ErrorRecord(
new JsonException(
String.Format(
CultureInfo.CurrentUICulture,
Properties.Resources.AzureVMSqlServerWrongSettingsFormat,
extension.PublicSettings),
e),
string.Empty,
ErrorCategory.ParserError,
null));
}

return context;
}
}
}
Loading