Skip to content

Commit e533dbf

Browse files
committed
Admin Export Template Image: Add Ops, TA Cmdlet and security check for exporting template image out of ARA
1 parent d6847b7 commit e533dbf

File tree

3 files changed

+57
-17
lines changed

3 files changed

+57
-17
lines changed

src/ServiceManagement/RemoteApp/Commands.RemoteApp/Microsoft.WindowsAzure.Commands.RemoteApp.dll-help.xml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4817,7 +4817,7 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
48174817
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
48184818
<maml:name>OverwriteExistingUserDisk</maml:name>
48194819
<maml:description>
4820-
<maml:para>Overwrite the existing user disk.</maml:para>
4820+
<maml:para>Overwrite existing user disk.</maml:para>
48214821
</maml:description>
48224822
</command:parameter>
48234823
</command:syntaxItem>
@@ -4866,7 +4866,7 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
48664866
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
48674867
<maml:name>OverwriteExistingUserDisk</maml:name>
48684868
<maml:description>
4869-
<maml:para>Overwrite the existing user disk</maml:para>
4869+
<maml:para>Overwrite existing user disk</maml:para>
48704870
</maml:description>
48714871
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
48724872
<dev:type>
@@ -5019,6 +5019,12 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
50195019
</maml:description>
50205020
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
50215021
</command:parameter>
5022+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5023+
<maml:name>OverwriteExistingUserDisk</maml:name>
5024+
<maml:description>
5025+
<maml:para>Overwrite existing user disk.</maml:para>
5026+
</maml:description>
5027+
</command:parameter>
50225028
</command:syntaxItem>
50235029
</command:syntax>
50245030
<!-- Cmdlet parameter section -->
@@ -5075,6 +5081,19 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
50755081
<dev:defaultValue>
50765082
</dev:defaultValue>
50775083
</command:parameter>
5084+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5085+
<maml:name>OverwriteExistingUserDisk</maml:name>
5086+
<maml:description>
5087+
<maml:para>Overwrite existing user disk</maml:para>
5088+
</maml:description>
5089+
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
5090+
<dev:type>
5091+
<maml:name>SwitchParameter</maml:name>
5092+
<maml:uri />
5093+
</dev:type>
5094+
<dev:defaultValue>
5095+
</dev:defaultValue>
5096+
</command:parameter>
50785097
</command:parameters>
50795098
<!-- Input - Output section-->
50805099
<command:inputTypes>
@@ -5134,7 +5153,7 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
51345153
<maml:para>C:\PS&gt;</maml:para>
51355154
</maml:introduction>
51365155
<dev:code>
5137-
Export-AzureRemoteAppUserDisk -CollectionName Contoso -DestinationStorageAccountName accountname -DestinationStorageAccountKey accountkey -DestinationStorageAccountContainerName containername
5156+
Export-AzureRemoteAppUserDisk -CollectionName Contoso -DestinationStorageAccountName accountname -DestinationStorageAccountKey accountkey -DestinationStorageAccountContainerName containername -OverwriteExistingUserDisk
51385157
</dev:code>
51395158
<dev:remarks>
51405159
<maml:para>Description</maml:para>
@@ -5218,6 +5237,12 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
52185237
</maml:description>
52195238
<command:parameterValue required="true" variableLength="false">string</command:parameterValue>
52205239
</command:parameter>
5240+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5241+
<maml:name>OverwriteExistingTemplateImage</maml:name>
5242+
<maml:description>
5243+
<maml:para>Overwrite existing template image.</maml:para>
5244+
</maml:description>
5245+
</command:parameter>
52215246
</command:syntaxItem>
52225247
</command:syntax>
52235248
<!-- Cmdlet parameter section -->
@@ -5274,6 +5299,19 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
52745299
<dev:defaultValue>
52755300
</dev:defaultValue>
52765301
</command:parameter>
5302+
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
5303+
<maml:name>OverwriteExistingTemplateImage</maml:name>
5304+
<maml:description>
5305+
<maml:para>Overwrite existing template image</maml:para>
5306+
</maml:description>
5307+
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
5308+
<dev:type>
5309+
<maml:name>SwitchParameter</maml:name>
5310+
<maml:uri />
5311+
</dev:type>
5312+
<dev:defaultValue>
5313+
</dev:defaultValue>
5314+
</command:parameter>
52775315
</command:parameters>
52785316
<!-- Input - Output section-->
52795317
<command:inputTypes>
@@ -5333,7 +5371,7 @@ Remove-AzureRemoteAppUser -CollectionName Contoso -Type OrgId -UserUpn user@cont
53335371
<maml:para>C:\PS&gt;</maml:para>
53345372
</maml:introduction>
53355373
<dev:code>
5336-
Export-AzureRemoteAppTemplateImage -CollectionName Contoso -DestinationStorageAccountName accountname -DestinationStorageAccountKey accountkey -DestinationStorageAccountContainerName containername
5374+
Export-AzureRemoteAppTemplateImage -CollectionName Contoso -DestinationStorageAccountName accountname -DestinationStorageAccountKey accountkey -DestinationStorageAccountContainerName containername -OverwriteExistingTemplateImage
53375375
</dev:code>
53385376
<dev:remarks>
53395377
<maml:para>Description</maml:para>

src/ServiceManagement/RemoteApp/Commands.RemoteApp/TemplateImage/ExportAzureRemoteAppTemplateImage.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,24 @@ public class ExportAzureRemoteAppTemplateImage : RdsCmdlet
4646
HelpMessage = "Destination azure storage account container name")]
4747
public string DestinationStorageAccountContainerName { get; set; }
4848

49+
[Parameter(Mandatory = false,
50+
HelpMessage = "Overwrite existing template image")]
51+
public SwitchParameter OverwriteExistingTemplateImage { get; set; }
52+
4953
public override void ExecuteCmdlet()
5054
{
5155
OperationResultWithTrackingId response = null;
5256

53-
if (ShouldProcess(CollectionName, "Migrate the template image of collection"))
57+
if (ShouldProcess(CollectionName, "Export template image of collection"))
5458
{
55-
if (ShouldContinue(DestinationStorageAccountContainerName, "Overwrite existing migration records in the destination container"))
56-
{
57-
response = CallClient(() => Client.TemplateImages.Migrate(CollectionName, DestinationStorageAccountName, DestinationStorageAccountKey, DestinationStorageAccountContainerName, true), Client.TemplateImages);
58-
}
59-
59+
response = CallClient(() => Client.TemplateImages.Migrate(CollectionName, DestinationStorageAccountName, DestinationStorageAccountKey, DestinationStorageAccountContainerName, OverwriteExistingTemplateImage.IsPresent), Client.TemplateImages);
60+
6061
if (response != null)
6162
{
6263
WriteTrackingId(response);
63-
}
64+
}
6465
}
65-
66+
6667
}
6768
}
6869
}

src/ServiceManagement/RemoteApp/Commands.RemoteApp/UserDisk/ExportAzureRemoteAppUserDisk.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,17 @@ public class ExportAzureRemoteAppUserDisk : RdsCmdlet
4646
HelpMessage = "Destination azure storage account container name")]
4747
public string DestinationStorageAccountContainerName { get; set; }
4848

49+
[Parameter(Mandatory = false,
50+
HelpMessage = "Overwrite existing user disks")]
51+
public SwitchParameter OverwriteExistingUserDisk { get; set; }
52+
4953
public override void ExecuteCmdlet()
5054
{
5155
OperationResultWithTrackingId response = null;
5256

53-
if (ShouldProcess(CollectionName, "Migrate user disks of collection"))
57+
if (ShouldProcess(CollectionName, "Export user disks of collection"))
5458
{
55-
if (ShouldContinue(DestinationStorageAccountContainerName, "Overwrite existing migration records in the destination container"))
56-
{
57-
response = CallClient(() => Client.UserDisks.Migrate(CollectionName, DestinationStorageAccountName, DestinationStorageAccountKey, DestinationStorageAccountContainerName, true), Client.UserDisks);
58-
}
59+
response = CallClient(() => Client.UserDisks.Migrate(CollectionName, DestinationStorageAccountName, DestinationStorageAccountKey, DestinationStorageAccountContainerName, OverwriteExistingUserDisk.IsPresent), Client.UserDisks);
5960

6061
if (response != null)
6162
{

0 commit comments

Comments
 (0)