Skip to content

Commit f252d31

Browse files
committed
updated to refer public NuGet, added setVaultContext, help file
1 parent 965764b commit f252d31

File tree

8 files changed

+678
-6
lines changed

8 files changed

+678
-6
lines changed

setup/azurecmdfiles.wxi

Lines changed: 378 additions & 0 deletions
Large diffs are not rendered by default.

src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/Commands.SiteRecovery.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<SpecificVersion>False</SpecificVersion>
3737
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.27-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
3838
</Reference>
39-
<Reference Include="Microsoft.Azure.Management.SiteRecovery, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
40-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServicesARM.0.0.22-preview\lib\net40\Microsoft.Azure.Management.SiteRecovery.dll</HintPath>
39+
<Reference Include="Microsoft.Azure.Management.SiteRecovery, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
40+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.SiteRecovery.0.1.0-preview\lib\net40\Microsoft.Azure.Management.SiteRecovery.dll</HintPath>
4141
<Private>True</Private>
4242
</Reference>
4343
<Reference Include="Microsoft.Azure.ResourceManager">

src/ResourceManager/SiteRecovery/Commands.SiteRecovery.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.0.27-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.RecoveryServicesARM" version="0.0.22-preview" targetFramework="net45" />
87
<package id="Microsoft.Azure.Management.Resources" version="2.18.1-preview" targetFramework="net45" />
8+
<package id="Microsoft.Azure.Management.SiteRecovery" version="0.1.0-preview" targetFramework="net45" />
99
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5571.32271-prerelease" targetFramework="net45" />
1111
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />

src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Commands.SiteRecovery.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
<SpecificVersion>False</SpecificVersion>
4949
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
5050
</Reference>
51-
<Reference Include="Microsoft.Azure.Management.SiteRecovery, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
52-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.RecoveryServicesARM.0.0.22-preview\lib\net40\Microsoft.Azure.Management.SiteRecovery.dll</HintPath>
51+
<Reference Include="Microsoft.Azure.Management.SiteRecovery, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
52+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.SiteRecovery.0.1.0-preview\lib\net40\Microsoft.Azure.Management.SiteRecovery.dll</HintPath>
5353
<Private>True</Private>
5454
</Reference>
5555
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -134,6 +134,7 @@
134134
<Compile Include="Server\GetAzureSiteRecoveryServer.cs" />
135135
<Compile Include="Utilities\CertUtils.cs" />
136136
<Compile Include="Utilities\Utilities.cs" />
137+
<Compile Include="Vault\SetAzureSiteRecoveryVaultSettings.cs" />
137138
<Compile Include="Vault\GetAzureSiteRecoveryVault.cs" />
138139
<Compile Include="Vault\GetAzureSiteRecoveryVaultSettings.cs" />
139140
<Compile Include="Vault\GetAzureSiteRecoveryVaultSettingsFile.cs" />
@@ -159,6 +160,11 @@
159160
<ItemGroup>
160161
<None Include="packages.config" />
161162
</ItemGroup>
163+
<ItemGroup>
164+
<Content Include="Microsoft.Azure.Commands.SiteRecovery.dll-help.xml">
165+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
166+
</Content>
167+
</ItemGroup>
162168
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
163169
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
164170
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

src/ResourceManager/SiteRecovery/Commands.SiteRecovery/Common/PSRecoveryServicesVaultExtendedInfoClient.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,36 @@ public ASRVaultCreds GenerateVaultCredential(X509Certificate2 managementCert, AS
128128
return asrVaultCreds;
129129
}
130130

131+
/// <summary>
132+
/// Changes the Vault context
133+
/// </summary>
134+
/// <param name="vault">vault object</param>
135+
/// <returns>credential object</returns>
136+
public ASRVaultCreds ChangeVaultContext(ASRVault vault)
137+
{
138+
// Update vault settings
139+
Utilities.UpdateVaultSettings(new ASRVaultCreds()
140+
{
141+
ResourceGroupName = vault.ResouceGroupName,
142+
ResourceName = vault.Name
143+
});
144+
145+
// Get Channel Integrity key
146+
Task<string> getChannelIntegrityKey = this.GetChannelIntegrityKey();
147+
getChannelIntegrityKey.Wait();
148+
149+
150+
// Update vault settings along with Channel integrity key
151+
Utilities.UpdateVaultSettings(new ASRVaultCreds()
152+
{
153+
ResourceGroupName = vault.ResouceGroupName,
154+
ResourceName = vault.Name,
155+
ChannelIntegrityKey = getChannelIntegrityKey.Result
156+
});
157+
158+
return asrVaultCreds;
159+
}
160+
131161
/// <summary>
132162
/// Method to update vault certificate
133163
/// </summary>
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
3+
<helpItems xmlns="http://msh" schema="maml">
4+
5+
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
6+
<command:details>
7+
<command:name>
8+
Get-AzureSiteRecoveryServer
9+
</command:name>
10+
<maml:description>
11+
<maml:para>Get information about Azure Site Recovery Server for current Azure Site Recovery vault</maml:para>
12+
</maml:description>
13+
<maml:copyright>
14+
<maml:para></maml:para>
15+
</maml:copyright>
16+
<command:verb>Get</command:verb>
17+
<command:noun>AzureSiteRecoveryServer</command:noun>
18+
<dev:version></dev:version>
19+
</command:details>
20+
<maml:description>
21+
<maml:para>Get information about Azure Site Recovery server for current Azure Site Recovery vault</maml:para>
22+
</maml:description>
23+
<!-- Cmdlet syntax section-->
24+
<command:syntax>
25+
<command:syntaxItem>
26+
<maml:name>Get-AzureSiteRecoveryServer</maml:name>
27+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named">
28+
<maml:name>Name</maml:name>
29+
<maml:description>
30+
<maml:para>Name of the Server</maml:para>
31+
</maml:description>
32+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
33+
</command:parameter>
34+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
35+
<maml:name>Profile</maml:name>
36+
<maml:description>
37+
<maml:para>Non-mandatory AzureProfile input object</maml:para>
38+
</maml:description>
39+
<command:parameterValue required="true" variableLength="false">AzureProfile</command:parameterValue>
40+
</command:parameter>
41+
</command:syntaxItem>
42+
<command:syntaxItem>
43+
<maml:name>Get-AzureSiteRecoveryServer</maml:name>
44+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named">
45+
<maml:name>FriendlyName</maml:name>
46+
<maml:description>
47+
<maml:para>FriendlyName of the Server</maml:para>
48+
</maml:description>
49+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
50+
</command:parameter>
51+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
52+
<maml:name>Profile</maml:name>
53+
<maml:description>
54+
<maml:para>Non-mandatory AzureProfile input object</maml:para>
55+
</maml:description>
56+
<command:parameterValue required="true" variableLength="false">AzureProfile</command:parameterValue>
57+
</command:parameter>
58+
</command:syntaxItem>
59+
</command:syntax>
60+
<!-- Cmdlet parameter section -->
61+
<command:parameters>
62+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named">
63+
<maml:name>FriendlyName</maml:name>
64+
<maml:description>
65+
<maml:para>FriendlyName of the Server</maml:para>
66+
67+
</maml:description>
68+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
69+
<dev:type>
70+
<maml:name>string</maml:name>
71+
<maml:uri/>
72+
</dev:type>
73+
<dev:defaultValue></dev:defaultValue>
74+
</command:parameter>
75+
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named">
76+
<maml:name>Name</maml:name>
77+
<maml:description>
78+
<maml:para>Name of the Server</maml:para>
79+
80+
</maml:description>
81+
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
82+
<dev:type>
83+
<maml:name>string</maml:name>
84+
<maml:uri/>
85+
</dev:type>
86+
<dev:defaultValue></dev:defaultValue>
87+
</command:parameter>
88+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
89+
<maml:name>Profile</maml:name>
90+
<maml:description>
91+
<maml:para>Non-mandatory AzureProfile input object</maml:para>
92+
93+
</maml:description>
94+
<command:parameterValue required="true" variableLength="false">AzureProfile</command:parameterValue>
95+
<dev:type>
96+
<maml:name>AzureProfile</maml:name>
97+
<maml:uri/>
98+
</dev:type>
99+
<dev:defaultValue></dev:defaultValue>
100+
</command:parameter>
101+
</command:parameters>
102+
<!-- Input - Output section-->
103+
<command:inputTypes>
104+
<command:inputType>
105+
<dev:type>
106+
<maml:name></maml:name>
107+
<maml:uri/>
108+
<maml:description />
109+
</dev:type>
110+
<maml:description>
111+
<maml:para>
112+
<!-- description -->
113+
114+
</maml:para>
115+
</maml:description>
116+
</command:inputType>
117+
</command:inputTypes>
118+
<command:returnValues>
119+
<command:returnValue>
120+
<dev:type>
121+
<maml:name></maml:name>
122+
<maml:uri />
123+
<maml:description />
124+
</dev:type>
125+
<maml:description>
126+
<maml:para>
127+
<!-- description -->
128+
129+
</maml:para>
130+
</maml:description>
131+
</command:returnValue>
132+
</command:returnValues>
133+
<!-- Error section-->
134+
<command:terminatingErrors />
135+
<command:nonTerminatingErrors />
136+
<!-- Notes section -->
137+
<maml:alertSet>
138+
<maml:title></maml:title>
139+
<maml:alert>
140+
<maml:para>
141+
142+
</maml:para>
143+
</maml:alert>
144+
<maml:alert>
145+
<maml:para></maml:para>
146+
</maml:alert>
147+
</maml:alertSet>
148+
<!-- Example section -->
149+
<command:examples>
150+
151+
<command:example>
152+
<maml:title>
153+
-------------------------- EXAMPLE 1 --------------------------
154+
</maml:title>
155+
<maml:introduction>
156+
<maml:para>PS C:\&gt;</maml:para>
157+
</maml:introduction>
158+
<dev:code>
159+
Get-AzureSiteRecoveryServer
160+
161+
FriendlyName : sriramvu-hv2.fareast.corp.microsoft.com
162+
Name : 57f95c35-6c83-42ce-bb21-2c4f10f92d8e
163+
ID : /Subscriptions/00a07ea0-ad8b-491c-9de8-77bf10881499/resourceGroups/testsitegroup/providers/Microsoft.
164+
SiteRecovery/SiteRecoveryVault/ppeVault2/Servers/57f95c35-6c83-42ce-bb21-2c4f10f92d8e
165+
Type : Microsoft.SiteRecovery/Servers
166+
FabricType : VMM
167+
FabricObjectID : 57f95c35-6c83-42ce-bb21-2c4f10f92d8e
168+
LastHeartbeat : 29-07-2015 10:52:09
169+
ProviderVersion : 3.5.601.0
170+
ServerVersion : 3.2.7510.0
171+
172+
</dev:code>
173+
<dev:remarks>
174+
<maml:para>Description</maml:para>
175+
<maml:para>-----------</maml:para>
176+
<maml:para></maml:para>
177+
<maml:para></maml:para>
178+
<maml:para></maml:para>
179+
<maml:para></maml:para>
180+
<maml:para></maml:para>
181+
</dev:remarks>
182+
<command:commandLines>
183+
<command:commandLine>
184+
<command:commandText></command:commandText>
185+
</command:commandLine>
186+
</command:commandLines>
187+
</command:example>
188+
</command:examples>
189+
<!-- Link section -->
190+
<maml:relatedLinks>
191+
<maml:navigationLink>
192+
<maml:linkText></maml:linkText>
193+
<maml:uri/>
194+
</maml:navigationLink>
195+
</maml:relatedLinks>
196+
</command:command>
197+
198+
</helpItems>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Management.Automation;
19+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
20+
using Microsoft.Azure.Portal.RecoveryServices.Models.Common;
21+
22+
namespace Microsoft.Azure.Commands.SiteRecovery
23+
{
24+
/// <summary>
25+
/// Retrieves Azure Site Recovery Vault Settings.
26+
/// </summary>
27+
[Cmdlet(VerbsCommon.Set, "AzureSiteRecoveryVaultSettings")]
28+
[OutputType(typeof(ASRVaultSettings))]
29+
public class SetAzureSiteRecoveryVaultSettings : SiteRecoveryCmdletBase
30+
{
31+
#region Parameters
32+
33+
/// <summary>
34+
/// Gets or sets vault Object.
35+
/// </summary>
36+
[Parameter(Mandatory = true, ValueFromPipeline = true)]
37+
[ValidateNotNullOrEmpty]
38+
public ASRVault Vault { get; set; }
39+
40+
#endregion Parameters
41+
42+
/// <summary>
43+
/// ProcessRecord of the command.
44+
/// </summary>
45+
public override void ExecuteCmdlet()
46+
{
47+
// Validate the Vault
48+
RecoveryServicesClient.ValidateVaultSettings(
49+
this.Vault.Name,
50+
this.Vault.ResouceGroupName);
51+
52+
// Change the vault context
53+
ASRVaultCreds vaultCreds = RecoveryServicesClient.ChangeVaultContext(this.Vault);
54+
55+
this.WriteObject(new ASRVaultSettings(
56+
PSRecoveryServicesClient.asrVaultCreds.ResourceName,
57+
PSRecoveryServicesClient.asrVaultCreds.ResourceGroupName));
58+
}
59+
}
60+
}

src/ResourceManager/SiteRecovery/Commands.SiteRecovery/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Authentication" version="1.0.27-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.RecoveryServicesARM" version="0.0.22-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Management.SiteRecovery" version="0.1.0-preview" targetFramework="net45" />
88
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
99
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
1010
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />

0 commit comments

Comments
 (0)