diff --git a/ChangeLog.md b/ChangeLog.md
index 65d7f779e90f..d574b4d8ff7a 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -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
diff --git a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj
index b574b78b254a..35f899433f69 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj
+++ b/src/ResourceManager/Compute/Commands.Compute/Commands.Compute.csproj
@@ -223,6 +223,17 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs b/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs
index 4b8a9a48c32f..69668d16bab2 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/Common/ConstantStringTypes.cs
@@ -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";
}
}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoBackupSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoBackupSettings.cs
new file mode 100644
index 000000000000..8ee4fc21c38d
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoBackupSettings.cs
@@ -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
+{
+ ///
+ /// Autobackup settings to configure managed backup on SQL VM
+ ///
+ public class AutoBackupSettings
+ {
+ ///
+ /// Defines if the Auto-backup feature is enabled or disabled
+ ///
+ public bool Enable { get; set; }
+
+ ///
+ /// Defines if backups will be encrypted or not
+ ///
+ public bool EnableEncryption { get; set; }
+
+ ///
+ /// Defines the number of days to keep the backups
+ ///
+ public int RetentionPeriod { get; set; }
+
+ ///
+ /// storage url where databases will be backed up
+ ///
+ [JsonIgnoreAttribute()]
+ public string StorageUrl { get; set; }
+
+ ///
+ /// Key of storage account used by managed backup
+ ///
+ [JsonIgnoreAttribute()]
+ public string StorageAccessKey { get; set; }
+
+ ///
+ /// Password required for certification when encryption is enabled
+ ///
+ [JsonIgnoreAttribute()]
+ public string Password { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoPatchingSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoPatchingSettings.cs
new file mode 100644
index 000000000000..f9dfd45d132d
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoPatchingSettings.cs
@@ -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
+{
+ ///
+ /// AutoPatching settings to configure auto-patching on SQL VM
+ ///
+ public class AutoPatchingSettings
+ {
+ ///
+ /// Enable / Disable auto patching
+ ///
+ public bool Enable { get; set; }
+
+ ///
+ /// Day of the week
+ ///
+ public string DayOfWeek { get; set; }
+
+ ///
+ /// Maintainance Windows Start hour ( 0 to 23 )
+ ///
+ public int MaintenanceWindowStartingHour { get; set; }
+
+ ///
+ /// Maintainance window duration in minutes
+ ///
+ public int MaintenanceWindowDuration { get; set; }
+
+ ///
+ /// Patch category returned as string
+ ///
+ public string PatchCategory { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoTelemetrySettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoTelemetrySettings.cs
new file mode 100644
index 000000000000..30d272831004
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerAutoTelemetrySettings.cs
@@ -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
+{
+ ///
+ /// AutoTelemetry settings to configure telemetry collection on SQL VM
+ ///
+ public class AutoTelemetrySettings
+ {
+ ///
+ /// The name of the region the VM is running in.
+ ///
+ public string Region { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerPrivateSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerPrivateSettings.cs
new file mode 100644
index 000000000000..30a6ffb2c61a
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerPrivateSettings.cs
@@ -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
+{
+ ///
+ /// SQL Server extension's private settings
+ ///
+ public class SqlServerPrivateSettings
+ {
+ ///
+ /// Azure blob store URL
+ ///
+ public string StorageUrl;
+
+ ///
+ /// Storage account access key
+ ///
+ public string StorageAccessKey;
+
+ ///
+ /// Password required for certification when encryption is enabled
+ ///
+ public string Password;
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerPublicSettings.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerPublicSettings.cs
new file mode 100644
index 000000000000..d10c6a466a34
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/AzureVMSqlServerPublicSettings.cs
@@ -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
+{
+ ///
+ /// SQL Server Extension's public settings
+ ///
+ public class SqlServerPublicSettings
+ {
+ ///
+ /// Auto patching settings
+ ///
+ public AutoPatchingSettings AutoPatchingSettings { get; set; }
+
+ ///
+ /// Auto-backup settings
+ ///
+ public AutoBackupSettings AutoBackupSettings { get; set; }
+
+ ///
+ /// Auto-telemetry settings
+ ///
+ public AutoTelemetrySettings AutoTelemetrySettings { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/GetAzureVMSqlServerExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/GetAzureVMSqlServerExtensionCommand.cs
new file mode 100644
index 000000000000..e7433aeb6558
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/GetAzureVMSqlServerExtensionCommand.cs
@@ -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(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;
+ }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/NewAzureVMSqlServerAutoBackupConfig.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/NewAzureVMSqlServerAutoBackupConfig.cs
new file mode 100644
index 000000000000..33cea12ad0a5
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/NewAzureVMSqlServerAutoBackupConfig.cs
@@ -0,0 +1,208 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System;
+using System.Management.Automation;
+using System.Security;
+using Microsoft.WindowsAzure.Commands.Common.Storage;
+using Microsoft.WindowsAzure.Storage;
+using Microsoft.Azure.Management.Storage;
+using System.Runtime.InteropServices;
+using System.Security.Permissions;
+
+namespace Microsoft.Azure.Commands.Compute
+{
+ ///
+ /// Helper cmdlet to construct instance of AutoBackup settings class
+ ///
+ [Cmdlet(
+ VerbsCommon.New,
+ AzureVMSqlServerAutoBackupConfigNoun,
+ DefaultParameterSetName = StorageUriParamSetName),
+ OutputType(
+ typeof(AutoBackupSettings))]
+ public class NewAzureVMSqlServerAutoBackupConfigCommand : PSCmdlet
+ {
+ protected const string AzureVMSqlServerAutoBackupConfigNoun = "AzureVMSqlServerAutoBackupConfig";
+
+ protected const string StorageContextParamSetName = "StorageContextSqlServerAutoBackup";
+ protected const string StorageUriParamSetName = "StorageUriSqlServerAutoBackup";
+
+ [Parameter(
+ Mandatory = true,
+ Position = 0,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The resource group name.")]
+ [ValidateNotNullOrEmpty]
+ public string ResourceGroupName { get; set; }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 1,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Enable Automatic Backup.")]
+ [ValidateNotNullOrEmpty]
+ public SwitchParameter Enable { get; set; }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 2,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Backup Retention period in days.")]
+ [ValidateNotNullOrEmpty]
+ public int RetentionPeriodInDays { get; set; }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 3,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Enable Backup Encryption.")]
+ [ValidateNotNullOrEmpty]
+ public SwitchParameter EnableEncryption { get; set; }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 4,
+ ValueFromPipelineByPropertyName = false,
+ HelpMessage = "Certificate password.")]
+ public SecureString CertificatePassword { get; set; }
+
+ [Parameter(
+ ParameterSetName = StorageContextParamSetName,
+ Mandatory = false,
+ Position = 5,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The storage connection context")]
+ [ValidateNotNullOrEmpty]
+ public AzureStorageContext StorageContext
+ {
+ get;
+ set;
+ }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 4,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The storage uri")]
+ [ValidateNotNullOrEmpty]
+ public Uri StorageUri
+ {
+ get;
+ set;
+ }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 5,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The storage access key")]
+ [ValidateNotNullOrEmpty]
+ public SecureString StorageKey
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// Initialzies a new instance of the class.
+ ///
+ public NewAzureVMSqlServerAutoBackupConfigCommand()
+ {
+ }
+
+ ///
+ /// Creates and returns object.
+ ///
+ protected override void ProcessRecord()
+ {
+ AutoBackupSettings autoBackupSettings = new AutoBackupSettings();
+
+ autoBackupSettings.Enable = (Enable.IsPresent) ? Enable.ToBool() : false;
+ autoBackupSettings.EnableEncryption = (EnableEncryption.IsPresent) ? EnableEncryption.ToBool() : false;
+ autoBackupSettings.RetentionPeriod = RetentionPeriodInDays;
+
+ switch(ParameterSetName)
+ {
+ case StorageContextParamSetName:
+ autoBackupSettings.StorageUrl = StorageContext.BlobEndPoint;
+ autoBackupSettings.StorageAccessKey = this.GetStorageKey();
+ break;
+
+ case StorageUriParamSetName:
+ autoBackupSettings.StorageUrl = (StorageUri == null)? null: StorageUri.ToString();
+ autoBackupSettings.StorageAccessKey = (StorageKey == null)? null: ConvertToUnsecureString(StorageKey);
+ break;
+ }
+
+ // Check if certificate password was set
+ autoBackupSettings.Password = (CertificatePassword == null) ? null : ConvertToUnsecureString(CertificatePassword);
+
+ WriteObject(autoBackupSettings);
+ }
+
+ protected string GetStorageKey()
+ {
+ string storageKey = string.Empty;
+ string storageName = (this.StorageContext == null) ? null : this.StorageContext.StorageAccountName;
+
+ if (!string.IsNullOrEmpty(storageName))
+ {
+ var storageClient = new StorageManagementClient();
+
+ var storageAccount = storageClient.StorageAccounts.GetProperties(this.ResourceGroupName, storageName);
+
+ if (storageAccount != null)
+ {
+ var keys = storageClient.StorageAccounts.ListKeys(this.ResourceGroupName, storageName);
+
+ if (keys != null && keys.StorageAccountKeys != null)
+ {
+ storageKey = !string.IsNullOrEmpty(keys.StorageAccountKeys.Key1) ?
+ keys.StorageAccountKeys.Key1 :
+ keys.StorageAccountKeys.Key2;
+ }
+ }
+ }
+
+ return storageKey;
+ }
+
+ ///
+ /// convert secure string to regular string
+ /// $Issue - for ARM cmdlets, check if there is a similair helper class library like Microsoft.WindowsAzure.Commands.ServiceManagement.Helpers
+ ///
+ ///
+ ///
+ [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ private static string ConvertToUnsecureString(SecureString securePassword)
+ {
+ if (securePassword == null)
+ {
+ throw new ArgumentNullException("securePassword");
+ }
+
+ IntPtr unmanagedString = IntPtr.Zero;
+ try
+ {
+ unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(securePassword);
+ return Marshal.PtrToStringUni(unmanagedString);
+ }
+ finally
+ {
+ Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString);
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/NewAzureVMSqlServerAutoPatchingConfig.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/NewAzureVMSqlServerAutoPatchingConfig.cs
new file mode 100644
index 000000000000..c589a75436d5
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/NewAzureVMSqlServerAutoPatchingConfig.cs
@@ -0,0 +1,71 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.Compute
+{
+ ///
+ /// Helper cmdlet to construct instance of AutoPatching settings class
+ ///
+ [Cmdlet(
+ VerbsCommon.New,
+ AzureVMSqlServerAutoPatchingConfigNoun),
+ OutputType(
+ typeof(AutoPatchingSettings))]
+ public class NewAzureVMSqlServerAutoPatchingConfigCommand : PSCmdlet
+ {
+ protected const string AzureVMSqlServerAutoPatchingConfigNoun = "AzureVMSqlServerAutoPatchingConfig";
+
+ [Parameter]
+ public SwitchParameter Enable { get; set; }
+
+ [Parameter]
+ [ValidateSetAttribute(new string[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Everyday" })]
+ public string DayOfWeek { get; set; }
+
+ [Parameter]
+ public int MaintenanceWindowStartingHour { get; set; }
+
+ [Parameter]
+ public int MaintenanceWindowDuration { get; set; }
+
+ [Parameter]
+ [ValidateSetAttribute(new string[] { "Important" })]
+ public string PatchCategory { get; set; }
+
+ ///
+ /// Initialzies a new instance of the class.
+ ///
+ public NewAzureVMSqlServerAutoPatchingConfigCommand()
+ {
+ }
+
+ ///
+ /// Creates and returns object.
+ ///
+ protected override void ProcessRecord()
+ {
+ AutoPatchingSettings autoPatchingSettings = new AutoPatchingSettings();
+
+ autoPatchingSettings.Enable = (Enable.IsPresent) ? Enable.ToBool() : false;
+ autoPatchingSettings.DayOfWeek = DayOfWeek;
+ autoPatchingSettings.MaintenanceWindowStartingHour = MaintenanceWindowStartingHour;
+ autoPatchingSettings.MaintenanceWindowDuration = MaintenanceWindowDuration;
+ autoPatchingSettings.PatchCategory = PatchCategory;
+
+ WriteObject(autoPatchingSettings);
+ }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/RemoveAzureVMSqlServerExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/RemoveAzureVMSqlServerExtensionCommand.cs
new file mode 100644
index 000000000000..cd6ba702c934
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/RemoveAzureVMSqlServerExtensionCommand.cs
@@ -0,0 +1,72 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Management.Compute;
+using System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.Compute
+{
+ [Cmdlet(
+ VerbsCommon.Remove,
+ ProfileNouns.VirtualMachineSqlServerExtension)]
+ public class RemoveAzureVMSqlServerExtensionCommand : VirtualMachineExtensionBaseCmdlet
+ {
+ [Parameter(
+ Mandatory = true,
+ Position = 0,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The resource group name.")]
+ [ValidateNotNullOrEmpty]
+ public string ResourceGroupName { get; set; }
+
+ [Alias("ResourceName")]
+ [Parameter(
+ Mandatory = true,
+ Position = 1,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The virtual machine name.")]
+ [ValidateNotNullOrEmpty]
+ public string VMName { get; set; }
+
+ [Alias("ExtensionName")]
+ [Parameter(
+ Mandatory = true,
+ Position = 2,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Name of the ARM resource that represents the extension. This is defaulted to 'Microsoft.SqlServer.Management.SqlIaaSAgent'.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ base.ExecuteCmdlet();
+
+ ExecuteClientAction(() =>
+ {
+ if (string.IsNullOrEmpty(Name))
+ {
+ Name = VirtualMachineSqlServerExtensionContext.ExtensionPublishedNamespace + "." + VirtualMachineSqlServerExtensionContext.ExtensionPublishedName;
+ }
+
+ if (this.ShouldContinue(Properties.Resources.VirtualMachineExtensionRemovalConfirmation, Properties.Resources.VirtualMachineExtensionRemovalCaption))
+ {
+ var op = this.VirtualMachineExtensionClient.Delete(this.ResourceGroupName, this.VMName, this.Name);
+ WriteObject(op);
+ }
+ });
+ }
+
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs
new file mode 100644
index 000000000000..3570d6447f18
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/SetAzureVMSqlServerExtensionCommand.cs
@@ -0,0 +1,158 @@
+// ----------------------------------------------------------------------------------
+//
+// 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 AutoMapper;
+using Microsoft.Azure.Commands.Compute.Common;
+using Microsoft.Azure.Commands.Compute.Models;
+using Microsoft.Azure.Management.Compute;
+using Microsoft.Azure.Management.Compute.Models;
+using Newtonsoft.Json;
+using System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.Compute
+{
+ [Cmdlet(
+ VerbsCommon.Set,
+ ProfileNouns.VirtualMachineSqlServerExtension)]
+ public class SetAzureSqlServerExtensionCommand : VirtualMachineExtensionBaseCmdlet
+ {
+ ///
+ /// The specific version of the SqlServer extension that Set-AzureVMSqlServerExtension will
+ /// apply the settings to.
+ ///
+ [Alias("HandlerVersion")]
+ [Parameter(
+ Position = 1,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The version of the SqlServer extension that Set-AzureVMSqlServerExtension will apply the settings to. " +
+ "Allowed format N.N")]
+ [ValidateNotNullOrEmpty]
+ public string Version { get; set; }
+
+ [Parameter(
+ Mandatory = true,
+ Position = 2,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The resource group name.")]
+ [ValidateNotNullOrEmpty]
+ public string ResourceGroupName { get; set; }
+
+ [Parameter(
+ Mandatory = true,
+ Position = 3,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Name of the virtual machine where Sql Server extension handler would be installed.")]
+ [ValidateNotNullOrEmpty]
+ public string VMName { get; set; }
+
+ [Parameter(
+ ValueFromPipelineByPropertyName = true,
+ Position = 4,
+ HelpMessage = "Name of the ARM resource that represents the extension. This is defaulted to 'Microsoft.SqlServer.Management.SqlIaaSAgent'.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 5,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The Automatic Patching configuration.")]
+ [ValidateNotNullOrEmpty]
+ public AutoPatchingSettings AutoPatchingSettings { get; set; }
+
+ [Parameter(
+ Mandatory = false,
+ Position = 6,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The Automatic Backup configuration.")]
+ [ValidateNotNullOrEmpty]
+ public AutoBackupSettings AutoBackupSettings { get; set; }
+
+ [Parameter(
+ Position = 7,
+ ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Location of the resource.")]
+ [ValidateNotNullOrEmpty]
+ public string Location { get; set; }
+
+ public override void ExecuteCmdlet()
+ {
+ base.ExecuteCmdlet();
+
+ var parameters = new VirtualMachineExtension
+ {
+ Location = this.Location,
+ Name = Name ?? VirtualMachineSqlServerExtensionContext.ExtensionPublishedNamespace + "." + VirtualMachineSqlServerExtensionContext.ExtensionPublishedName,
+ Type = VirtualMachineExtensionType,
+ Publisher = VirtualMachineSqlServerExtensionContext.ExtensionPublishedNamespace,
+ ExtensionType = VirtualMachineSqlServerExtensionContext.ExtensionPublishedName,
+ TypeHandlerVersion = string.IsNullOrEmpty(this.Version) ? VirtualMachineSqlServerExtensionContext.ExtensionDefaultVersion : this.Version,
+ Settings = this.GetPublicConfiguration(),
+ ProtectedSettings = this.GetPrivateConfiguration(),
+ };
+
+ // Add retry logic due to CRP service restart known issue CRP bug: 3564713
+ // Similair approach taken in DSC cmdlet as well
+ var count = 1;
+ ComputeLongRunningOperationResponse op = null;
+ while (count <= 2)
+ {
+ op = VirtualMachineExtensionClient.CreateOrUpdate(
+ ResourceGroupName,
+ VMName,
+ parameters);
+
+ if (ComputeOperationStatus.Failed.Equals(op.Status) && op.Error != null && "InternalExecutionError".Equals(op.Error.Code))
+ {
+ count++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ var result = Mapper.Map(op);
+ WriteObject(result);
+ }
+
+ ///
+ /// Returns the public configuration as string
+ ///
+ ///
+ private string GetPublicConfiguration()
+ {
+ return JsonConvert.SerializeObject(
+ new SqlServerPublicSettings
+ {
+ AutoPatchingSettings = this.AutoPatchingSettings,
+ AutoBackupSettings = this.AutoBackupSettings,
+ AutoTelemetrySettings = new AutoTelemetrySettings() { Region = this.Location}
+ });
+ }
+
+ ///
+ /// Returns private configuration as string
+ ///
+ ///
+ private string GetPrivateConfiguration()
+ {
+ return JsonConvert.SerializeObject(
+ new SqlServerPrivateSettings
+ {
+ StorageUrl = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.StorageUrl,
+ StorageAccessKey = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.StorageAccessKey,
+ Password = (this.AutoBackupSettings == null) ? string.Empty : this.AutoBackupSettings.Password
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/VirtualMachineSqlServerExtensionContext.cs b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/VirtualMachineSqlServerExtensionContext.cs
new file mode 100644
index 000000000000..c172036af9e1
--- /dev/null
+++ b/src/ResourceManager/Compute/Commands.Compute/Extension/SqlServer/VirtualMachineSqlServerExtensionContext.cs
@@ -0,0 +1,52 @@
+// ----------------------------------------------------------------------------------
+//
+// 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.Models;
+using Newtonsoft.Json;
+using System;
+using System.Collections;
+
+namespace Microsoft.Azure.Commands.Compute
+{
+ ///
+ /// SQL VM Extension's context object used by Get-AzureVMSqlServerExtension
+ ///
+ public class VirtualMachineSqlServerExtensionContext : PSVirtualMachineExtension
+ {
+ ///
+ /// SQLVM Extension's publisher name
+ ///
+ public const string ExtensionPublishedNamespace = "Microsoft.SqlServer.Management";
+
+ ///
+ /// SQLVM Extension's name
+ ///
+ public const string ExtensionPublishedName = "SqlIaaSAgent";
+
+ ///
+ /// SQLVM Extension's default version
+ ///
+ public const string ExtensionDefaultVersion = "1.*";
+
+ ///
+ /// Auto-patching settings
+ ///
+ public AutoPatchingSettings AutoPatchingSettings;
+
+ ///
+ /// Auto-backup settings
+ ///
+ public AutoBackupSettings AutoBackupSettings;
+ }
+}
diff --git a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs
index e984dd08fc3d..ed794d3ece51 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs
+++ b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.Designer.cs
@@ -223,6 +223,16 @@ public static string AzureVMDscWrongSettingsFormat {
}
}
+ ///
+ /// Looks up a localized string similar to Cannot deserialize settings string from Sql Server extension. Updating your Azure PowerShell SDK to the latest version may solve this problem. Settings string:
+ ///{0}.
+ ///
+ public static string AzureVMSqlServerWrongSettingsFormat {
+ get {
+ return ResourceManager.GetString("AzureVMSqlServerWrongSettingsFormat", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Cannot specify both Windows and Linux configurations..
///
diff --git a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx
index 2c5329e5f5f6..461ee2451a21 100644
--- a/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx
+++ b/src/ResourceManager/Compute/Commands.Compute/Properties/Resources.resx
@@ -362,4 +362,9 @@ The file needs to be a PowerShell script (.ps1 or .psm1).
A data disk, {0}, is not currently assigned for this VM. Use Add-AzureVMDataDisk to add it.
+
+ Cannot deserialize settings string from Sql Server extension. Updating your Azure PowerShell SDK to the latest version may solve this problem. Settings string:
+{0}
+ {0} settings json string
+
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
index 536e9500d0ff..7afeb0988eff 100644
--- a/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
+++ b/src/ResourceManager/Resources/Commands.Resources.Test/Commands.Resources.Test.csproj
@@ -186,7 +186,6 @@
-
@@ -474,7 +473,7 @@
Always
-
+
Always
diff --git a/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroups/GetAzureResourceGroupLogCommandTests.cs b/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroups/GetAzureResourceGroupLogCommandTests.cs
deleted file mode 100644
index 9428c416b372..000000000000
--- a/src/ResourceManager/Resources/Commands.Resources.Test/ResourceGroups/GetAzureResourceGroupLogCommandTests.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-// ----------------------------------------------------------------------------------
-//
-// 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 System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Management.Automation;
-using Microsoft.Azure.Commands.Resources.Models;
-using Microsoft.WindowsAzure.Commands.ScenarioTest;
-using Moq;
-using Xunit;
-
-namespace Microsoft.Azure.Commands.Resources.Test
-{
- public class GetAzureResourceGroupLogCommandTests
- {
- private GetAzureResourceGroupLogCommand cmdlet;
-
- private Mock resourcesClientMock;
-
- private Mock commandRuntimeMock;
-
- public GetAzureResourceGroupLogCommandTests()
- {
- resourcesClientMock = new Mock();
- commandRuntimeMock = new Mock();
- cmdlet = new GetAzureResourceGroupLogCommand()
- {
- CommandRuntime = commandRuntimeMock.Object,
- ResourcesClient = resourcesClientMock.Object
- };
- }
-
- // TODO: http://vstfrd:8080/Azure/RD/_workitems#_a=edit&id=3247094
- //[Fact]
- //[Trait(Category.AcceptanceType, Category.CheckIn)]
- //public void GetAzureResourceGroupLogOutputsProperties()
- //{
- // List result = new List();
- // result.Add(new PSDeploymentEventData
- // {
- // EventId = "ac7d2ab5-698a-4c33-9c19-0a93d3d7f527",
- // EventName = "Start request",
- // EventSource = "Microsoft Resources",
- // Channels = "Operation",
- // Level = "Informational",
- // Timestamp = DateTime.Now,
- // OperationId = "c0f2e85f-efb0-47d0-bf90-f983ec8be91d",
- // OperationName = "Microsoft.Resources/subscriptions/resourcegroups/deployments/write",
- // Status = "Succeeded",
- // SubStatus = "Created",
- // ResourceGroupName = "foo",
- // ResourceProvider = "Microsoft Resources",
- // ResourceUri =
- // "/subscriptions/ffce8037-a374-48bf-901d-dac4e3ea8c09/resourcegroups/foo/deployments/testdeploy",
- // HttpRequest = new PSDeploymentEventDataHttpRequest
- // {
- // Url = "http://path/subscriptions/ffce8037-a374-48bf-901d-dac4e3ea8c09/resourcegroups/foo/deployments/testdeploy",
- // Method = "PUT",
- // ClientId = "1234",
- // ClientIpAddress = "123.123.123.123"
- // },
- // Authorization = new PSDeploymentEventDataAuthorization
- // {
- // Action = "PUT",
- // Condition = "",
- // Role = "Sender",
- // Scope = "None"
- // },
- // Claims = new Dictionary
- // {
- // {"aud", "https://management.core.windows.net/"},
- // {"iss", "https://sts.windows.net/123456/"},
- // {"iat", "h123445"}
- // },
- // Properties = new Dictionary()
- // });
-
- // GetPSResourceGroupLogParameters expected = new GetPSResourceGroupLogParameters();
-
- // resourcesClientMock.Setup(f => f.GetResourceGroupLogs(It.IsAny()))
- // .Returns(result)
- // .Callback((GetPSResourceGroupLogParameters r) => expected = r);
-
- // cmdlet.Name = "foo";
-
- // cmdlet.ExecuteCmdlet();
-
- // Assert.Equal(1, result.Count());
- // Assert.Equal("foo", expected.Name);
- //}
- }
-}
diff --git a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj
index 08d91354ed46..a0144ef468ef 100644
--- a/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj
+++ b/src/ResourceManager/Resources/Commands.Resources/Commands.Resources.csproj
@@ -203,7 +203,6 @@
-
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs
index 9e62bfdf2ce6..3719b435d38c 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/GetAzureResourceGroupDeploymentCommand.cs
@@ -47,11 +47,10 @@ public override void ExecuteCmdlet()
new List() { ProvisioningState }
};
- if(!string.IsNullOrEmpty(Name))
+ if(!string.IsNullOrEmpty(ProvisioningState))
{
- WriteWarning("The parameter 'Name' in Get-AzureResourceGroupDeployment cmdlet is being renamed to DeploymentName and will be updated in a future release.");
+ WriteWarning("The ProvisioningState parameter is being deprecated and will be removed in a future release.");
}
-
WriteObject(ResourcesClient.FilterResourceGroupDeployments(options), true);
}
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs
index 916570c27eba..76a1555eb444 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/NewAzureResourceGroupDeploymentCommand.cs
@@ -61,9 +61,9 @@ public override void ExecuteCmdlet()
StorageAccountName = StorageAccountName
};
- if(!string.IsNullOrEmpty(TemplateVersion) || !string.IsNullOrEmpty(StorageAccountName))
+ if (!string.IsNullOrEmpty(TemplateVersion) || !string.IsNullOrEmpty(StorageAccountName) || !string.IsNullOrEmpty(GalleryTemplateIdentity))
{
- WriteWarning("The TemplateVersion and StorageAccountName parameters in New-AzureResourceGroupDeployment cmdlet is being deprecated and will be removed in a future release.");
+ WriteWarning("The GalleryTemplateIdentity, TemplateVersion and StorageAccountName parameters in New-AzureResourceGroupDeployment cmdlet is being deprecated and will be removed in a future release.");
}
if(this.Mode == DeploymentMode.Complete)
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs
index 8a90dfa99070..718995251566 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/RemoveAzureResourceGroupDeploymentCommand.cs
@@ -50,6 +50,7 @@ public override void ExecuteCmdlet()
if (PassThru)
{
+ WriteWarning("The PassThru switch parameter is being deprecated and will be removed in a future release.");
WriteObject(true);
}
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs
index 7ddcb77495fe..2e73d77ec4a6 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroupDeployments/StopAzureResourceGroupDeploymentCommand.cs
@@ -50,6 +50,7 @@ public override void ExecuteCmdlet()
if (PassThru)
{
+ WriteWarning("The output object of this cmdlet will be modified in a future release.");
WriteObject(true);
}
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureLocationCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureLocationCommand.cs
index 69834262df57..08a86bfbd99d 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureLocationCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureLocationCommand.cs
@@ -29,6 +29,7 @@ public class GetAzureLocationCommand : ResourcesBaseCmdlet, IModuleAssemblyIniti
{
public override void ExecuteCmdlet()
{
+ WriteWarning("The output object of this cmdlet will be modified in a future release.");
WriteObject(ResourcesClient.GetLocations(), true);
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs
index 12ece2649c21..c3725bd00a90 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupCommand.cs
@@ -38,6 +38,15 @@ public class GetAzureResourceGroupCommand : ResourcesBaseCmdlet
public override void ExecuteCmdlet()
{
+ if(this.Tag != null)
+ {
+ WriteWarning("The Tag parameter is being deprecated and will be removed in a future release.");
+ }
+ if(this.Detailed.IsPresent)
+ {
+ WriteWarning("The Detailed switch parameter is being deprecated and will be removed in a future release.");
+ }
+ WriteWarning("The output object of this cmdlet will be modified in a future release.");
var detailed = Detailed.IsPresent || !string.IsNullOrEmpty(Name);
WriteObject(ResourcesClient.FilterResourceGroups(Name, Tag, detailed), true);
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupLogCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupLogCommand.cs
deleted file mode 100644
index d8572700da5c..000000000000
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/GetAzureResourceGroupLogCommand.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// ----------------------------------------------------------------------------------
-//
-// 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 System.Collections.Generic;
-using System.Management.Automation;
-using Microsoft.Azure.Commands.Resources.Models;
-
-namespace Microsoft.Azure.Commands.Resources
-{
- ///
- /// Get the list of events for a deployment.
- ///
- // TODO: http://vstfrd:8080/Azure/RD/_workitems#_a=edit&id=3247094
- //[Cmdlet(VerbsCommon.Get, "AzureResourceGroupLog", DefaultParameterSetName = LastDeploymentSetName), OutputType(typeof(List))]
- public class GetAzureResourceGroupLogCommand : ResourcesBaseCmdlet
- {
- internal const string AllSetName = "All";
- internal const string LastDeploymentSetName = "Last deployment";
- internal const string DeploymentNameSetName = "Deployment by name";
-
- [Alias("ResourceGroupName")]
- [Parameter(Position = 0, ParameterSetName = AllSetName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Name of the resource group you want to see the logs.")]
- [Parameter(Position = 0, ParameterSetName = LastDeploymentSetName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Name of the resource group you want to see the logs.")]
- [Parameter(Position = 0, ParameterSetName = DeploymentNameSetName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Name of the resource group you want to see the logs.")]
- [ValidateNotNullOrEmpty]
- public string Name { get; set; }
-
- [Parameter(ParameterSetName = DeploymentNameSetName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "Name of the deployment whose logs you want to see.")]
- [ValidateNotNullOrEmpty]
- public string DeploymentName { get; set; }
-
- [Parameter(ParameterSetName = AllSetName, HelpMessage = "Optional. If given, return logs of all the operations including CRUD and deployment.")]
- public SwitchParameter All { get; set; }
-
- public override void ExecuteCmdlet()
- {
- GetPSResourceGroupLogParameters parameters = new GetPSResourceGroupLogParameters
- {
- Name = Name,
- DeploymentName = DeploymentName,
- All = All.IsPresent
- };
-
- // TODO: http://vstfrd:8080/Azure/RD/_workitems#_a=edit&id=3247094
- //WriteObject(ResourcesClient.GetResourceGroupLogs(parameters), true);
- }
- }
-}
\ No newline at end of file
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs
index f1c2f1c2d8d8..c87d87fdaabf 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/NewAzureResourceGroupCommand.cs
@@ -67,6 +67,7 @@ public override void ExecuteCmdlet()
{
WriteWarning("The deployment parameters in New-AzureResourceGroup cmdlet is being deprecated and will be removed in a future release. Please use New-AzureResourceGroupDeployment to submit deployments.");
}
+ WriteWarning("The output object of this cmdlet will be modified in a future release.");
WriteObject(ResourcesClient.CreatePSResourceGroup(parameters));
}
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/RemoveAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/RemoveAzureResourceGroupCommand.cs
index 3466c35e8ee1..4ca85c73e5af 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/RemoveAzureResourceGroupCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/RemoveAzureResourceGroupCommand.cs
@@ -46,6 +46,7 @@ public override void ExecuteCmdlet()
if (PassThru)
{
+ WriteWarning("The PassThru switch parameter is being deprecated and will be removed in a future release.");
WriteObject(true);
}
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/SetAzureResourceGroupCommand.cs b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/SetAzureResourceGroupCommand.cs
index f0229511ca01..7b9b06753775 100644
--- a/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/SetAzureResourceGroupCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/ResourceGroups/SetAzureResourceGroupCommand.cs
@@ -40,7 +40,7 @@ public override void ExecuteCmdlet()
ResourceGroupName = Name,
Tag = Tag
};
-
+ WriteWarning("The output object of this cmdlet will be modified in a future release.");
WriteObject(ResourcesClient.UpdatePSResourceGroup(parameters));
}
}
diff --git a/src/ResourceManager/Resources/Commands.Resources/Templates/GetAzureResourceGroupGalleryTemplateCommand.cs b/src/ResourceManager/Resources/Commands.Resources/Templates/GetAzureResourceGroupGalleryTemplateCommand.cs
index 54fdb43e08f3..ce355a4d61ec 100644
--- a/src/ResourceManager/Resources/Commands.Resources/Templates/GetAzureResourceGroupGalleryTemplateCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/Templates/GetAzureResourceGroupGalleryTemplateCommand.cs
@@ -49,6 +49,7 @@ public class GetAzureResourceGroupGalleryTemplateCommand : ResourcesBaseCmdlet
public override void ExecuteCmdlet()
{
+ WriteWarning("This cmdlet is being deprecated and will be removed in a future release.");
FilterGalleryTemplatesOptions options = new FilterGalleryTemplatesOptions()
{
Category = Category,
diff --git a/src/ResourceManager/Resources/Commands.Resources/Templates/SaveAzureResourceGroupGalleryTemplateCommand.cs b/src/ResourceManager/Resources/Commands.Resources/Templates/SaveAzureResourceGroupGalleryTemplateCommand.cs
index b16092d8d93f..1e5d49804fd9 100644
--- a/src/ResourceManager/Resources/Commands.Resources/Templates/SaveAzureResourceGroupGalleryTemplateCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/Templates/SaveAzureResourceGroupGalleryTemplateCommand.cs
@@ -37,6 +37,7 @@ public class SaveAzureResourceGroupGalleryTemplateCommand : ResourcesBaseCmdlet
public override void ExecuteCmdlet()
{
+ WriteWarning("This cmdlet is being deprecated and will be removed in a future release.");
string path = GalleryTemplatesClient.DownloadGalleryTemplateFile(
Identity,
string.IsNullOrEmpty(Path) ? System.IO.Path.Combine(CurrentPath(), Identity) : this.TryResolvePath(Path),
diff --git a/src/ResourceManager/Resources/Commands.Resources/Templates/TestAzureResourceGroupTemplateCommand.cs b/src/ResourceManager/Resources/Commands.Resources/Templates/TestAzureResourceGroupTemplateCommand.cs
index 7b9b658e11d1..ec3a01c99250 100644
--- a/src/ResourceManager/Resources/Commands.Resources/Templates/TestAzureResourceGroupTemplateCommand.cs
+++ b/src/ResourceManager/Resources/Commands.Resources/Templates/TestAzureResourceGroupTemplateCommand.cs
@@ -41,6 +41,10 @@ public TestAzureResourceGroupTemplateCommand()
public override void ExecuteCmdlet()
{
this.WriteWarning("The Test-AzureResourceGroupTemplate cmdlet is being renamed to Test-AzureResourceGroupDeployment in a future release.");
+ if (!string.IsNullOrEmpty(TemplateVersion) || !string.IsNullOrEmpty(StorageAccountName) || !string.IsNullOrEmpty(GalleryTemplateIdentity))
+ {
+ WriteWarning("The GalleryTemplateIdentity, TemplateVersion and StorageAccountName parameters are being deprecated and will be removed in a future release.");
+ }
ValidatePSResourceGroupDeploymentParameters parameters = new ValidatePSResourceGroupDeploymentParameters()
{
ResourceGroupName = ResourceGroupName,