diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs index ec188f3d5ee5..36ba804e8e69 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs @@ -14,12 +14,16 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets { - internal static class AzureBackupCmdletHelpMessage { public const string Vault = "The vault details"; public const string PolicyName = "The protection policy name."; public const string ResourceGroupName = "The ResourceGroup name."; public const string ResourceName = "The Resource name."; + public const string TargetLocation = "The directory where the credentials file will be saved."; + public const string ContainerName = "The container name."; + public const string ContainerId = "The container ID."; + public const string ContainerRegistrationStatus = "The container registration status."; + public const string ContainerType = "The container type."; } } diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs new file mode 100644 index 000000000000..025ac6a20fad --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs @@ -0,0 +1,60 @@ +// ---------------------------------------------------------------------------------- +// +// 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 System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + /// + /// Get list of containers + /// + [Cmdlet(VerbsCommon.Get, "AzureBackupContainer"), OutputType(typeof(AzureBackupContainer), typeof(List))] + public class GetAzureBackupContainer : AzureBackupVaultCmdletBase + { + [Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerName)] + [ValidateNotNullOrEmpty] + public string Name { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerId)] + [ValidateNotNullOrEmpty] + public string Id { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerRegistrationStatus)] + [ValidateNotNullOrEmpty] + public AzureBackupContainerStatus Status { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerType)] + [ValidateNotNullOrEmpty] + public AzureBackupContainerType Type { get; set; } + + public override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + ExecutionBlock(() => + { + IEnumerable containers = new List(); + + // TODO: Call Hydra + + WriteObject(containers); + }); + } + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/ProtectionPolicy/GetAzureBackupProtectionPolicy.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/ProtectionPolicy/GetAzureBackupProtectionPolicy.cs index 322690782d8c..ab0e95779733 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/ProtectionPolicy/GetAzureBackupProtectionPolicy.cs +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/ProtectionPolicy/GetAzureBackupProtectionPolicy.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets { /// - /// Get list of containers + /// Get list of protection policies /// [Cmdlet(VerbsCommon.Get, "AzureBackupProtectionPolicy"), OutputType(typeof(AzureBackupProtectionPolicy), typeof(List))] public class GetAzureBackupProtectionPolicy : AzureBackupVaultCmdletBase diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/AcsNamespace.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/AcsNamespace.cs new file mode 100644 index 000000000000..873419510e8a --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/AcsNamespace.cs @@ -0,0 +1,61 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + /// + /// AcsNamespace is where the certificate is uploaded into + /// + public class AcsNamespace + { + /// + /// Gets or sets the key name for HostName entry + /// + public string HostName { get; set; } + + /// + /// Gets or sets the key name for Namespace entry + /// + public string Namespace { get; set; } + + /// + /// Gets or sets the value for ResourceProviderRealm entry + /// + public string ResourceProviderRealm { get; set; } + + /// + /// Initializes a new instance of the AcsNamespace class + /// + public AcsNamespace() { } + + /// + /// Initializes a new instance of the AcsNamespace class. + /// + /// host name + /// acs namespace + /// rp realm + public AcsNamespace(string hostName, string acsNmespace, string resourceProviderRealm) + { + this.HostName = hostName; + this.Namespace = acsNmespace; + this.ResourceProviderRealm = resourceProviderRealm; + } + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/CertUtils.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/CertUtils.cs new file mode 100644 index 000000000000..9bcde86a6431 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/CertUtils.cs @@ -0,0 +1,131 @@ +// ---------------------------------------------------------------------------------- +// +// 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.WindowsAzure.Management; +using Microsoft.WindowsAzure.Management.EventSources; +using Security.Cryptography; +using Security.Cryptography.X509Certificates; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + /// + /// Certificate utility methods + /// + public class CertUtils + { + public const string MsEnhancedProv = "Microsoft Enhanced Cryptographic Provider v1.0"; + public const string DefaultIssuer = "CN=Windows Azure Tools"; + + public const string DefaultPassword = ""; + public const string OIDClientAuthValue = "1.3.6.1.5.5.7.3.2"; + public const string OIDClientAuthFriendlyName = "Client Authentication"; + public const int KeySize2048 = 2048; + + /// + /// Windows Azure Service Management API requires 2048bit RSA keys. + /// The private key needs to be exportable so we can save it to .pfx for sharing with team members. + /// + /// A 2048 bit RSA key + private static CngKey Create2048RsaKey() + { + var keyCreationParameters = new CngKeyCreationParameters + { + ExportPolicy = CngExportPolicies.AllowExport, + KeyCreationOptions = CngKeyCreationOptions.None, + KeyUsage = CngKeyUsages.AllUsages, + Provider = new CngProvider(MsEnhancedProv) + }; + + keyCreationParameters.Parameters.Add(new CngProperty("Length", BitConverter.GetBytes(KeySize2048), CngPropertyOptions.None)); + + return CngKey.Create(CngAlgorithm2.Rsa, null, keyCreationParameters); + } + + /// + /// Creates a new self-signed X509 certificate + /// + /// The certificate issuer + /// Human readable name + /// The certificate's password + /// Certificate creation date & time + /// Certificate expiry date & time + /// An X509Certificate2 + public static X509Certificate2 CreateSelfSignedCert(string issuer, string friendlyName, string password, DateTime startTime, DateTime endTime) + { + string distinguishedNameString = issuer; + var key = Create2048RsaKey(); + + var creationParams = new X509CertificateCreationParameters(new X500DistinguishedName(distinguishedNameString)) + { + TakeOwnershipOfKey = true, + StartTime = startTime, + EndTime = endTime + }; + + // adding client authentication, -eku = 1.3.6.1.5.5.7.3.2, + // This is mandatory for the upload to be successful + OidCollection oidCollection = new OidCollection(); + oidCollection.Add(new Oid(OIDClientAuthValue, OIDClientAuthFriendlyName)); + creationParams.Extensions.Add(new X509EnhancedKeyUsageExtension(oidCollection, false)); + + // Documentation of CreateSelfSignedCertificate states: + // If creationParameters have TakeOwnershipOfKey set to true, the certificate + // generated will own the key and the input CngKey will be disposed to ensure + // that the caller doesn't accidentally use it beyond its lifetime (which is + // now controlled by the certificate object). + // We don't dispose it ourselves in this case. + var cert = key.CreateSelfSignedCertificate(creationParams); + key = null; + cert.FriendlyName = friendlyName; + + // X509 certificate needs PersistKeySet flag set. + // Reload a new X509Certificate2 instance from exported bytes in order to set the PersistKeySet flag. + var bytes = cert.Export(X509ContentType.Pfx, password); + + // NOTE: PfxValidation is not done here because these are newly created certs and assumed valid. + + ICommonEventSource evtSource = null; + return X509Certificate2Helper.NewX509Certificate2(bytes, password, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable, evtSource, doPfxValidation: false); + } + + /// + /// Returns serialized certificate - Base64 encoded based on the content type + /// + /// The certificate provided + /// Cert content type + /// The serialized cert value in string + public static string SerializeCert(X509Certificate2 cert, X509ContentType contentType) + { + return Convert.ToBase64String(cert.Export(contentType)); + } + + /// + /// Generates friendly name + /// + /// Subscription id + /// Prefix, likely resource name + /// Friendly name + public static string GenerateCertFriendlyName(string subscriptionId, string prefix = "") + { + return string.Format("{0}{1}-{2}-vaultcredentials", prefix, subscriptionId, DateTime.Now.ToString("M-d-yyyy")); + } + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/Constants.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/Constants.cs new file mode 100644 index 000000000000..f22d134b53b6 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/Constants.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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + public class Constants + { + public const int VaultCertificateExpiryInHoursForBackup = 48; + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs new file mode 100644 index 000000000000..c3169e239210 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/GetAzureBackupVaultCredentials.cs @@ -0,0 +1,201 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Management.BackupServices.Models; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Net; +using System.Runtime.Serialization; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + /// + /// API to download the azure backup vault's credentials. + /// + [Cmdlet(VerbsCommon.Get, "AzureBackupVaultCredentials"), OutputType(typeof(string))] + public class GetAzureBackupVaultCredentials : AzureBackupVaultCmdletBase + { + [Parameter(Position = 2, Mandatory = true, HelpMessage = AzureBackupCmdletHelpMessage.TargetLocation)] + [ValidateNotNullOrEmpty] + public string TargetLocation { get; set; } + + public override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + ExecutionBlock(() => + { + WriteVerbose(string.Format("Profile == null : {0}", (Profile == null).ToString())); + WriteVerbose(string.Format("Profile.DefaultSubscription == null : {0}", (Profile.DefaultSubscription == null).ToString())); + string subscriptionId = Profile.DefaultSubscription.Id.ToString(); + string resourceType = "resourceType"; + string displayName = subscriptionId + "_" + ResourceGroupName + "_" + ResourceName; + + WriteVerbose(string.Format(CultureInfo.InvariantCulture, + "Executing cmdlet with SubscriptionId = {0}, ResourceGroupName = {1}, ResourceName = {2}, TargetLocation = {3}", + subscriptionId, ResourceGroupName, ResourceName, TargetLocation)); + + X509Certificate2 cert = CertUtils.CreateSelfSignedCert(CertUtils.DefaultIssuer, + CertUtils.GenerateCertFriendlyName(subscriptionId, ResourceName), + CertUtils.DefaultPassword, + DateTime.UtcNow.AddMinutes(-10), + DateTime.UtcNow.AddHours(this.GetCertificateExpiryInHours())); + + AcsNamespace acsNamespace = new AcsNamespace(); + + string channelIntegrityKey = string.Empty; + try + { + // Upload cert into ID Mgmt + WriteVerbose(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Going to upload the certificate")); + acsNamespace = UploadCert(cert, subscriptionId, ResourceName, resourceType, ResourceGroupName); + WriteVerbose(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Successfully uploaded the certificate")); + } + catch (Exception exception) + { + throw exception; + } + + // generate vault credentials + string vaultCredsFileContent = GenerateVaultCreds(cert, subscriptionId, resourceType, acsNamespace); + + // prepare for download + string fileName = string.Format("{0}_{1}.VaultCredentials", displayName, DateTime.UtcNow.ToLongDateString()); + string filePath = Path.Combine(Path.GetDirectoryName(TargetLocation), fileName); + File.WriteAllBytes(filePath, Encoding.UTF8.GetBytes(vaultCredsFileContent)); + + // Output filename back to user + WriteObject(fileName); + }); + } + + /// + /// Method to return the Certificate Expiry time in hours + /// + /// + /// + private int GetCertificateExpiryInHours(string resourceType = null) + { + return Constants.VaultCertificateExpiryInHoursForBackup; + } + + /// + /// Upload certificate + /// + /// management certificate + /// subscription Id + /// resource name + /// resource type + /// resource group name + /// acs namespace of the uploaded cert + private AcsNamespace UploadCert(X509Certificate2 cert, string subscriptionId, string resourceName, string resourceType, string resourceGroupName) + { + string rawCertDataString = Convert.ToBase64String(cert.RawData); + VaultCredUploadCertRequest vaultCredUploadCertRequest = new VaultCredUploadCertRequest() + { + RawCertificateData = new RawCertificateData() + { + Certificate = rawCertDataString, + }, + }; + + string response = string.Empty; + VaultCredUploadCertResponse vaultCredUploadCertResponse = + AzureBackupClient.VaultCredentials.UploadCertificateAsync( + "IdMgmtInternalCert", + vaultCredUploadCertRequest, + GetCustomRequestHeaders(), + CmdletCancellationToken).Result; + + return new AcsNamespace(vaultCredUploadCertResponse.ResourceCertificateAndACSDetails.GlobalAcsHostName, + vaultCredUploadCertResponse.ResourceCertificateAndACSDetails.GlobalAcsNamespace, + vaultCredUploadCertResponse.ResourceCertificateAndACSDetails.GlobalAcsRPRealm); + } + + /// + /// Generates vault creds file + /// + /// management certificate + /// subscription Id + /// resource type + /// display name + /// acs namespace + /// xml file in string format + private string GenerateVaultCreds(X509Certificate2 cert, string subscriptionId, string resourceType, AcsNamespace acsNamespace) + { + try + { + return GenerateVaultCredsForBackup(cert, subscriptionId, resourceType, acsNamespace); + } + catch (Exception exception) + { + throw exception; + } + } + + /// + /// Generates vault creds file content for backup Vault + /// + /// management certificate + /// subscription Id + /// resource type + /// display name + /// acs namespace + /// xml file in string format + private string GenerateVaultCredsForBackup(X509Certificate2 cert, string subscriptionId, string resourceType, AcsNamespace acsNamespace) + { + using (var output = new MemoryStream()) + { + using (var writer = XmlWriter.Create(output, GetXmlWriterSettings())) + { + BackupVaultCreds backupVaultCreds = new BackupVaultCreds(subscriptionId, + resourceType, + ResourceName, + CertUtils.SerializeCert(cert, X509ContentType.Pfx), + acsNamespace); + + DataContractSerializer serializer = new DataContractSerializer(typeof(BackupVaultCreds)); + serializer.WriteObject(writer, backupVaultCreds); + + WriteVerbose(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Backup Vault - Successfully serialized the file content")); + } + + return Encoding.UTF8.GetString(output.ToArray()); + } + } + + /// + /// A set of XmlWriterSettings to use for the publishing profile + /// + /// The XmlWriterSettings set + private XmlWriterSettings GetXmlWriterSettings() + { + return new XmlWriterSettings + { + Encoding = new UTF8Encoding(false), + Indent = true, + NewLineOnAttributes = true + }; + } + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/VaultCredentials.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/VaultCredentials.cs new file mode 100644 index 000000000000..cc5c1bdc17a7 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/VaultCredentials/VaultCredentials.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + /// + /// Class to define vault credentials + /// + [DataContract] + public class VaultCreds + { + #region Properties + + /// + /// Gets or sets the key name for SubscriptionId entry + /// + [DataMember(Order = 0)] + public string SubscriptionId { get; set; } + + /// + /// Gets or sets the key name for ResourceType entry + /// + [DataMember(Order = 1)] + public string ResourceType { get; set; } + + /// + /// Gets or sets the key name for ResourceName entry + /// + [DataMember(Order = 2)] + public string ResourceName { get; set; } + + /// + /// Gets or sets the key name for ManagementCert entry + /// + [DataMember(Order = 3)] + public string ManagementCert { get; set; } + + /// + /// Gets or sets the key name for AcsNamespace entry + /// + [DataMember(Order = 4)] + public AcsNamespace AcsNamespace { get; set; } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the VaultCreds class + /// + public VaultCreds() { } + + /// + /// Initializes a new instance of the VaultCreds class + /// + /// subscription id + /// resource type + /// resource name + /// management cert + /// acs namespace + public VaultCreds(string subscriptionId, string resourceType, string resourceName, string managementCert, AcsNamespace acsNamespace) + { + SubscriptionId = subscriptionId; + ResourceType = resourceType; + ResourceName = resourceName; + ManagementCert = managementCert; + AcsNamespace = acsNamespace; + } + + #endregion + } + + /// + /// Class to define backup vault credentials + /// + [SuppressMessage("Microsoft.StyleCop.CSharp.MaintainabilityRules", "SA1402:FileMayOnlyContainASingleClass", Justification = "Grouping classes based on entity")] + public class BackupVaultCreds : VaultCreds + { + /// + /// Gets or sets the agent links + /// + [DataMember(Order = 0)] + public string AgentLinks { get; set; } + + #region Constructors + + /// + /// Initializes a new instance of the BackupVaultCreds class + /// + public BackupVaultCreds() + { + } + + /// + /// Initializes a new instance of the BackupVaultCreds class + /// + /// subscription Id + /// resource type + /// resource name + /// management cert + /// acs namespace + public BackupVaultCreds(string subscriptionId, string resourceType, string resourceName, string managementCert, AcsNamespace acsNamespace) + : base(subscriptionId, resourceType, resourceName, managementCert, acsNamespace) { } + + /// + /// Initializes a new instance of the BackupVaultCreds class + /// + /// subscription Id + /// resource type + /// resource name + /// management cert + /// acs namespace + /// agent links + public BackupVaultCreds(string subscriptionId, string resourceType, string resourceName, string managementCert, AcsNamespace acsNamespace, string agentLinks) + : this(subscriptionId, resourceType, resourceName, managementCert, acsNamespace) + { + AgentLinks = agentLinks; + } + + #endregion + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj index eac24317ee67..d844b2eabb8f 100644 --- a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj @@ -78,7 +78,11 @@ ..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll - ..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net40-Debug\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll + ..\..\..\..\..\azure-sdk-for-net\binaries\net40\Microsoft.WindowsAzure.Management.BackupServicesManagment.dll + + + False + Cmdlets\VaultCredentials\Microsoft.WindowsAzure.Management.Common.dll ..\..\..\packages\Microsoft.WindowsAzure.Management.Scheduler.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Scheduler.dll @@ -86,8 +90,10 @@ ..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + Cmdlets\VaultCredentials\Security.Cryptography.dll + - @@ -115,11 +121,18 @@ + - + + + + + + + @@ -155,7 +168,10 @@ Resources.Designer.cs - + + + + diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerStatus.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerStatus.cs new file mode 100644 index 000000000000..ed3d37517fa6 --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerStatus.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + public enum AzureBackupContainerStatus + { + Registered, + Registering, + NotRegistered + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerType.cs b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerType.cs new file mode 100644 index 000000000000..6875a8cbd60f --- /dev/null +++ b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Models/AzureBackupContainerType.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. +// ---------------------------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets +{ + public enum AzureBackupContainerType + { + AzureVirtualMachine + } +} diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.WindowsAzure.Management.Common.dll b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.WindowsAzure.Management.Common.dll new file mode 100644 index 000000000000..0ff26b7d81de Binary files /dev/null and b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Microsoft.WindowsAzure.Management.Common.dll differ diff --git a/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Security.Cryptography.dll b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Security.Cryptography.dll new file mode 100644 index 000000000000..867eefea6aa2 Binary files /dev/null and b/src/ResourceManager/AzureBackup/Commands.AzureBackup/Resources/Security.Cryptography.dll differ