Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mab1 #268

Open
wants to merge 22 commits into
base: vishak-dev1
Choose a base branch
from
Open

Mab1 #268

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c7e0564
Adding GetAzureRmRecoveryServicesVaultBackupCredentials
pikumarmsft16 Apr 4, 2016
509afb7
Changing file name format.
pikumarmsft16 Apr 5, 2016
6d766c7
changing namespace in getAzureRmRecoveryServicesVaultBackupCredentials
pikumarmsft16 Apr 5, 2016
f16d5cd
Get/Set AzureRmRecoveryServices changes
vishak-ms Apr 7, 2016
b003b74
[Get/Set AzureRmRecoveryServicesvault] Adding Missing Files and some …
vishak-ms Apr 7, 2016
ace0fc3
Merging ASR and Backup get-VaultCred cmdlet.
pikumarmsft16 Apr 11, 2016
09899c2
Revert "[Get/Set AzureRmRecoveryServicesvault] Adding Missing Files a…
vishak-ms Apr 12, 2016
56701bd
Revert "Get/Set AzureRmRecoveryServices changes"
vishak-ms Apr 12, 2016
7471ce8
Get/Set AzureRmRecoveryServicesBackupProperties
vishak-ms Apr 12, 2016
3b064df
merging files.
pikumarmsft16 Apr 12, 2016
cea53bf
Adding backup vault cred code to Get-AzureRmRecoveryVaultSettingFiles.cs
pikumarmsft16 Apr 12, 2016
30b5ef7
Merge branch 'mab1' into pikumar-mab1
pikumarmsft16 Apr 12, 2016
1105812
removing nuget changes from csproj
pikumarmsft16 Apr 12, 2016
ca483e5
Revert "Get/Set AzureRmRecoveryServicesBackupProperties"
vishak-ms Apr 12, 2016
b18dc35
Merge branch 'mab1' into pikumar-mab1
pikumarmsft16 Apr 12, 2016
13edbe5
Adding strings to resex file
pikumarmsft16 Apr 12, 2016
5901345
Get\Set AzureRmRecoveryServicesBackupProperties
vishak-ms Apr 12, 2016
8b6c206
minor fix as per PR comments
pikumarmsft16 Apr 13, 2016
e8b4c44
[Changing Sesson Record]Get\Set AzureRmRecoveryServicesBackupProperties
vishak-ms Apr 13, 2016
b35042b
Merge pull request #4 from RecoveryServicesOneSDK/vishak-lrs
avneeshraiusit Apr 13, 2016
196bfd3
Making SiteRecovery as optional
pikumarmsft16 Apr 13, 2016
61246c4
Merge pull request #3 from RecoveryServicesOneSDK/pikumar-mab1
pikumarmsft16 Apr 14, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.1.0.2-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RecoveryServicesDLL\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Recovery Services Vault CRUD Tests
function Test-RecoveryServicesVaultCRUDTests
{
# Create vault
$vaultCreationResponse = New-AzureRmRecoveryServicesVault -Name rsv1 -ResourceGroupName S91-1 -Location westus
$vaultCreationResponse = New-AzureRmRecoveryServicesVault -Name rsv1 -ResourceGroupName vishakintdrg -Location westus
Assert-NotNull($vaultCreationResponse.Name)
Assert-NotNull($vaultCreationResponse.ID)
Assert-NotNull($vaultCreationResponse.Type)
Expand All @@ -37,14 +37,19 @@ function Test-RecoveryServicesVaultCRUDTests
Assert-NotNull($vault.Type)
}

$vaultBackupProperties = Get-AzureRmRecoveryServicesBackupProperties -Vault $vaultCreationResponse
Assert-NotNull($vaultBackupProperties.BackupStorageRedundancy)

Set-AzureRmRecoveryServicesBackupProperties -Vault $vaultCreationResponse -BackupStorageRedundancy "LocallyRedundant"

# Get the created vault
$vaultToBeRemoved = Get-AzureRmRecoveryServicesVault -ResourceGroupName S91-1 -Name rsv1
$vaultToBeRemoved = Get-AzureRmRecoveryServicesVault -ResourceGroupName vishakintdrg -Name rsv1
Assert-NotNull($vaultToBeRemoved.Name)
Assert-NotNull($vaultToBeRemoved.ID)
Assert-NotNull($vaultToBeRemoved.Type)

# Remove Vault
Remove-AzureRmRecoveryServicesVault -Vault $vaultToBeRemoved
$vaults = Get-AzureRmRecoveryServicesVault -ResourceGroupName S91-1 -Name rsv1
$vaults = Get-AzureRmRecoveryServicesVault -ResourceGroupName vishakintdrg -Name rsv1
Assert-True { $vaults.Count -eq 0 }
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ public static T GetServiceClient<T>() where T : class
if (testEnvironment.UsesCustomUri())
{
client = new RecoveryServicesManagementClient(
"Microsoft.RecoveryServicesBVTD2",
"Microsoft.RecoveryServicesBVTD",
testEnvironment.Credentials as SubscriptionCloudCredentials,
testEnvironment.BaseUri);
}
else
{
client = new RecoveryServicesManagementClient(
"Microsoft.RecoveryServicesBVTD2",
"Microsoft.RecoveryServicesBVTD",
testEnvironment.Credentials as SubscriptionCloudCredentials);
}
return GetServiceClient<T>(factory, client);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.RecoveryServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServices.1.0.2-preview\lib\net40\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
<Private>True</Private>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\RecoveryServicesDLL\Microsoft.Azure.Management.RecoveryServices.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.18.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.18.206251556\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
Expand Down Expand Up @@ -129,10 +129,12 @@
</Compile>
<Compile Include="Utilities\CertUtils.cs" />
<Compile Include="Utilities\Utilities.cs" />
<Compile Include="Vault\GetAzureRmRecoveryServicesBackupProperties.cs" />
<Compile Include="Vault\GetAzureRmRecoveryServicesVaults.cs" />
<Compile Include="Vault\GetAzureRmRecoveryServicesVaultSettingsFile.cs" />
<Compile Include="Vault\NewAzureRmRecoveryServicesVault.cs" />
<Compile Include="Vault\RemoveAzureRmRecoveryServicesVault.cs" />
<Compile Include="Vault\SetAzureRmRecoveryServicesBackupProperties.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,31 @@ public ResourceGroupListResponse GetResouceGroups()
{
return this.GetRecoveryServicesClient.ResourceGroup.List();
}


/// <summary>
/// Method to Update Azure Recovery Services Vault Backup Properties
/// </summary>
/// <param name="resouceGroupName">Name of the resouce group</param>
/// <param name="vaultName">Name of the vault</param>
/// <param name="vaultStorageUpdateRequest">Backup Properties Update</param>
/// <returns>Azure Operation response object.</returns>
public AzureOperationResponse UpdateVaultStorageType(string resouceGroupName, string vaultName, UpdateVaultStorageTypeRequest vaultStorageUpdateRequest)
{
return this.recoveryServicesClient.Vaults.UpdateStorageType(resouceGroupName, vaultName,
vaultStorageUpdateRequest, this.GetRequestHeaders());
}

/// <summary>
/// Method to Get Azure Recovery Services Vault Backup Properties
/// </summary>
/// <param name="resouceGroupName">Name of the resouce group</param>
/// <param name="vaultName">Name of the vault</param>
/// <returns>Azure Resource Storage response object.</returns>
public GetResourceStorageConfigResponse GetVaultStorageType(string resouceGroupName, string vaultName)
{
return this.recoveryServicesClient.Vaults.GetResourceStorageConfig(resouceGroupName, vaultName, this.GetRequestHeaders());
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,27 @@ public ASRVaultCreds GenerateVaultCredential(X509Certificate2 managementCert, AR
return asrVaultCreds;
}

/// <summary>
/// Upload cert to idmgmt
/// </summary>
/// <param name="managementCert">certificate to be uploaded</param>
/// <param name="vault">vault object</param>
/// <returns>Upload Certificate Response</returns>
public UploadCertificateResponse UploadCertificate(X509Certificate2 managementCert, ARSVault vault)
{
var certificateArgs = new CertificateArgs();
certificateArgs.Properties = new Dictionary<string, string>();
certificateArgs.Properties.Add("certificate", Convert.ToBase64String(managementCert.GetRawCertData()));

var response = this.recoveryServicesClient.VaultExtendedInfo.UploadCertificateAsync(
vault.ResouceGroupName,
vault.Name,
certificateArgs, managementCert.FriendlyName,
this.GetRequestHeaders());
response.Wait();
return response.Result;
}

/// <summary>
/// Changes the Vault context
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public class ARMExceptionDetails
DefaultValueHandling = DefaultValueHandling.Ignore)]
public string ClientRequestId { get; private set; }

/// <summary>
/// <summary>
/// Gets the activity Id for the session.
/// </summary>
[JsonProperty(PropertyName = "activityId")]
Expand Down Expand Up @@ -358,10 +358,11 @@ public VaultCreds()
/// <param name="resourceName">resource name</param>
/// <param name="managementCert">management cert</param>
/// <param name="acsNamespace">authenticating service namespace</param>
public VaultCreds(string subscriptionId, string resourceName, string managementCert, AcsNamespace acsNamespace)
/// <param name="resourceType">resource type backup vault or ASR vault</param>
public VaultCreds(string subscriptionId, string resourceName, string managementCert, AcsNamespace acsNamespace, string resourceType = null)
{
this.SubscriptionId = subscriptionId;
this.ResourceType = Constants.ASRVaultType;
this.ResourceType = string.IsNullOrEmpty(resourceType) ? Constants.ASRVaultType : resourceType;
this.ResourceName = resourceName;
this.ManagementCert = managementCert;
this.AcsNamespace = acsNamespace;
Expand Down Expand Up @@ -504,6 +505,54 @@ public ASRVaultCreds(
#endregion
}

/// <summary>
/// Class to define backup vault credentials
/// </summary>
[DataContract]
public class BackupVaultCreds : VaultCreds
{
/// <summary>
/// Gets or sets the agent links
/// </summary>
[DataMember(Order = 0)]
public string AgentLinks { get; set; }

#region Constructors

/// <summary>
/// Initializes a new instance of the BackupVaultCreds class
/// </summary>
public BackupVaultCreds() { }

/// <summary>
/// Initializes a new instance of the BackupVaultCreds class
/// </summary>
/// <param name="subscriptionId">subscription Id</param>
/// <param name="resourceType">resource type</param>
/// <param name="resourceName">resource name</param>
/// <param name="managementCert">management cert</param>
/// <param name="acsNamespace">acs namespace</param>
public BackupVaultCreds(string subscriptionId, string resourceName, string managementCert, AcsNamespace acsNamespace)
: base(subscriptionId, resourceName, managementCert, acsNamespace, Constants.BackupVaultType) { }

/// <summary>
/// Initializes a new instance of the BackupVaultCreds class
/// </summary>
/// <param name="subscriptionId">subscription Id</param>
/// <param name="resourceType">resource type</param>
/// <param name="resourceName">resource name</param>
/// <param name="managementCert">management cert</param>
/// <param name="acsNamespace">acs namespace</param>
/// <param name="agentLinks">agent links</param>
public BackupVaultCreds(string subscriptionId, string resourceName, string managementCert, AcsNamespace acsNamespace, string agentLinks)
: this(subscriptionId, resourceName, managementCert, acsNamespace)
{
AgentLinks = agentLinks;
}

#endregion
}

/// <summary>
/// Class to define ACS name space
/// </summary>
Expand All @@ -520,9 +569,10 @@ public class AcsNamespace
/// <param name="acsDetails">authenticating service Details name</param>
public AcsNamespace(UploadCertificateResponse acsDetails)
{
this.HostName = acsDetails.Properties.GlobalAcsHostName;
this.Namespace = acsDetails.Properties.GlobalAcsNamespace;
this.ResourceProviderRealm = acsDetails.Properties.GlobalAcsRPRealm;
this.HostName = (acsDetails.Properties as ACSCertificateProperties).GlobalAcsHostName;
this.Namespace = (acsDetails.Properties as ACSCertificateProperties).GlobalAcsNamespace;
this.ResourceProviderRealm = (acsDetails.Properties as ACSCertificateProperties).GlobalAcsRPRealm;

}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public class Constants
/// </summary>
public const string ASRVaultType = "HyperVRecoveryManagerVault";

/// <summary>
/// Backup vault type
/// </summary>
public const string BackupVaultType = "Vaults";

/// <summary>
/// Vault Credential version.
/// </summary>
Expand Down Expand Up @@ -135,7 +140,7 @@ public ARSVault(VaultCreateResponse vault)
public class ASRVaultProperties
{
#region Properties

/// <summary>
/// Gets or sets Provisioning State.
/// </summary>
Expand All @@ -144,6 +149,18 @@ public class ASRVaultProperties
#endregion
}

public class ASRVaultBackupProperties
{
#region Properties

/// <summary>
/// Gets or sets BackupStorageRedundancy type.
/// </summary>
public string BackupStorageRedundancy { get; set; }

#endregion
}

/// <summary>
/// Class to define the output of the vault settings file generation.
/// </summary>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,22 @@ Please provide a storage account with the same location as that of the vault.</v
<data name="SiteNotFound" xml:space="preserve">
<value>Site {0} is not associated with the Vault {1}</value>
</data>
<data name="BackupVaultSerialized" xml:space="preserve">
<value>RecoveryService - Backup Vault - Successfully serialized the file content</value>
</data>
<data name="ExecutingGetVaultCredCmdlet" xml:space="preserve">
<value>Executing cmdlet with SubscriptionId = {0}, ResourceGroupName = {1}, ResourceName = {2}, TargetLocation = {3}</value>
</data>
<data name="SavingVaultCred" xml:space="preserve">
<value>Saving Vault Credentials to file : {0}</value>
</data>
<data name="UploadedCertToIdmgmt" xml:space="preserve">
<value>RecoveryService - Successfully uploaded the certificate</value>
</data>
<data name="UploadingCertToIdmgmt" xml:space="preserve">
<value>RecoveryService - Going to upload the certificate</value>
</data>
<data name="VaultCredPathException" xml:space="preserve">
<value>The target location provided is not a directory. Please provide a directory.</value>
</data>
</root>
Loading