Skip to content

Commit 3477556

Browse files
authored
Merge pull request #4762 from matthchr/feature/batch-psh-vnext
Update Batch commandlets to support latest APIs
2 parents afe4928 + 64f67d8 commit 3477556

File tree

228 files changed

+9611
-5818
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+9611
-5818
lines changed

src/ResourceManager/AzureBatch/AzureRM.Batch.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ CmdletsToExport = 'Remove-AzureRmBatchAccount', 'Get-AzureRmBatchAccount',
106106
'New-AzureBatchComputeNodeUser', 'Remove-AzureBatchComputeNodeUser',
107107
'Enable-AzureBatchTask', 'Set-AzureBatchTask', 'Stop-AzureBatchTask',
108108
'Get-AzureBatchComputeNode', 'Get-AzureBatchJobSchedule',
109-
'New-AzureBatchJobSchedule', 'Remove-AzureBatchJobSchedule'
109+
'New-AzureBatchJobSchedule', 'Remove-AzureBatchJobSchedule',
110+
'Get-AzureBatchTaskCounts'
110111

111112
# Variables to export from this module
112113
# VariablesToExport = @()

src/ResourceManager/AzureBatch/BatchModelGenerator/Program.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ public class Program
3232
private static readonly Dictionary<string, string> OMtoPSClassMappings = new Dictionary<string, string>()
3333
{
3434
{"Microsoft.Azure.Batch.AffinityInformation", "PSAffinityInformation"},
35+
{"Microsoft.Azure.Batch.AuthenticationTokenSettings", "PSAuthenticationTokenSettings"},
3536
{"Microsoft.Azure.Batch.AutoPoolSpecification", "PSAutoPoolSpecification"},
3637
{"Microsoft.Azure.Batch.AutoScaleRun", "PSAutoScaleRun"},
3738
{"Microsoft.Azure.Batch.AutoScaleRunError", "PSAutoScaleRunError"},
39+
{"Microsoft.Azure.Batch.AutoUserSpecification", "PSAutoUserSpecification"},
3840
{"Microsoft.Azure.Batch.ApplicationPackageReference", "PSApplicationPackageReference"},
3941
{"Microsoft.Azure.Batch.Certificate", "PSCertificate"},
4042
{"Microsoft.Azure.Batch.CertificateReference", "PSCertificateReference"},
@@ -44,9 +46,13 @@ public class Program
4446
{"Microsoft.Azure.Batch.CloudTask", "PSCloudTask"},
4547
{"Microsoft.Azure.Batch.CloudServiceConfiguration", "PSCloudServiceConfiguration"},
4648
{"Microsoft.Azure.Batch.ComputeNode", "PSComputeNode"},
49+
{"Microsoft.Azure.Batch.ComputeNodeEndpointConfiguration", "PSComputeNodeEndpointConfiguration"},
4750
{"Microsoft.Azure.Batch.ComputeNodeError", "PSComputeNodeError"},
4851
{"Microsoft.Azure.Batch.ComputeNodeInformation", "PSComputeNodeInformation"},
4952
{"Microsoft.Azure.Batch.ComputeNodeUser", "PSComputeNodeUser"},
53+
{"Microsoft.Azure.Batch.ContainerConfiguration", "PSContainerConfiguration"},
54+
{"Microsoft.Azure.Batch.ContainerRegistry", "PSContainerRegistry"},
55+
{"Microsoft.Azure.Batch.DataDisk", "PSDataDisk"},
5056
{"Microsoft.Azure.Batch.DeleteCertificateError", "PSDeleteCertificateError"},
5157
{"Microsoft.Azure.Batch.EnvironmentSetting", "PSEnvironmentSetting"},
5258
{"Microsoft.Azure.Batch.ExitConditions", "PSExitConditions"},
@@ -55,6 +61,8 @@ public class Program
5561
{"Microsoft.Azure.Batch.ExitOptions", "PSExitOptions"},
5662
{"Microsoft.Azure.Batch.FileProperties", "PSFileProperties"},
5763
{"Microsoft.Azure.Batch.ImageReference", "PSImageReference"},
64+
{"Microsoft.Azure.Batch.InboundEndpoint", "PSInboundEndpoint"},
65+
{"Microsoft.Azure.Batch.InboundNatPool", "PSInboundNatPool"},
5866
{"Microsoft.Azure.Batch.RemoteLoginSettings", "PSRemoteLoginSettings"},
5967
{"Microsoft.Azure.Batch.JobConstraints", "PSJobConstraints"},
6068
{"Microsoft.Azure.Batch.JobExecutionInformation", "PSJobExecutionInformation"},
@@ -69,12 +77,20 @@ public class Program
6977
{"Microsoft.Azure.Batch.JobSchedulingError", "PSJobSchedulingError"},
7078
{"Microsoft.Azure.Batch.JobSpecification", "PSJobSpecification"},
7179
{"Microsoft.Azure.Batch.JobStatistics", "PSJobStatistics"},
80+
{"Microsoft.Azure.Batch.LinuxUserConfiguration", "PSLinuxUserConfiguration"},
7281
{"Microsoft.Azure.Batch.MetadataItem", "PSMetadataItem"},
7382
{"Microsoft.Azure.Batch.MultiInstanceSettings", "PSMultiInstanceSettings"},
7483
{"Microsoft.Azure.Batch.NameValuePair", "PSNameValuePair"},
7584
{"Microsoft.Azure.Batch.NetworkConfiguration", "PSNetworkConfiguration"},
85+
{"Microsoft.Azure.Batch.NetworkSecurityGroupRule", "PSNetworkSecurityGroupRule"},
7686
{"Microsoft.Azure.Batch.NodeAgentSku", "PSNodeAgentSku"},
7787
{"Microsoft.Azure.Batch.NodeFile", "PSNodeFile"},
88+
{"Microsoft.Azure.Batch.OSDisk", "PSOSDisk"},
89+
{"Microsoft.Azure.Batch.OutputFile", "PSOutputFile"},
90+
{"Microsoft.Azure.Batch.OutputFileDestination", "PSOutputFileDestination"},
91+
{"Microsoft.Azure.Batch.OutputFileUploadOptions", "PSOutputFileUploadOptions"},
92+
{"Microsoft.Azure.Batch.OutputFileBlobContainerDestination", "PSOutputFileBlobContainerDestination"},
93+
{"Microsoft.Azure.Batch.PoolEndpointConfiguration", "PSPoolEndpointConfiguration"},
7894
{"Microsoft.Azure.Batch.PoolInformation", "PSPoolInformation"},
7995
{"Microsoft.Azure.Batch.PoolSpecification", "PSPoolSpecification"},
8096
{"Microsoft.Azure.Batch.PoolStatistics", "PSPoolStatistics"},
@@ -88,14 +104,19 @@ public class Program
88104
{"Microsoft.Azure.Batch.StartTaskInformation", "PSStartTaskInformation"},
89105
{"Microsoft.Azure.Batch.SubtaskInformation", "PSSubtaskInformation"},
90106
{"Microsoft.Azure.Batch.TaskConstraints", "PSTaskConstraints"},
107+
{"Microsoft.Azure.Batch.TaskContainerExecutionInformation", "PSTaskContainerExecutionInformation"},
108+
{"Microsoft.Azure.Batch.TaskContainerSettings", "PSTaskContainerSettings"},
109+
{"Microsoft.Azure.Batch.TaskCounts", "PSTaskCounts"},
91110
{"Microsoft.Azure.Batch.TaskDependencies", "PSTaskDependencies"},
92111
{"Microsoft.Azure.Batch.TaskExecutionInformation", "PSTaskExecutionInformation"},
93112
{"Microsoft.Azure.Batch.TaskInformation", "PSTaskInformation"},
94113
{"Microsoft.Azure.Batch.TaskIdRange", "PSTaskIdRange"},
95-
{"Microsoft.Azure.Batch.TaskSchedulingError", "PSTaskSchedulingError"},
114+
{"Microsoft.Azure.Batch.TaskFailureInformation", "PSTaskFailureInformation"},
96115
{"Microsoft.Azure.Batch.TaskSchedulingPolicy", "PSTaskSchedulingPolicy"},
97116
{"Microsoft.Azure.Batch.TaskStatistics", "PSTaskStatistics"},
98117
{"Microsoft.Azure.Batch.UsageStatistics", "PSUsageStatistics"},
118+
{"Microsoft.Azure.Batch.UserAccount", "PSUserAccount"},
119+
{"Microsoft.Azure.Batch.UserIdentity", "PSUserIdentity"},
99120
{"Microsoft.Azure.Batch.VirtualMachineConfiguration", "PSVirtualMachineConfiguration"},
100121
{"Microsoft.Azure.Batch.WindowsConfiguration", "PSWindowsConfiguration"},
101122
};

src/ResourceManager/AzureBatch/ChangeLog.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,63 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Added new parameters to `New-AzureRmBatchAccount`.
22+
- `PoolAllocationMode`: The allocation mode to use for creating pools in the Batch account. To create a Batch account which allocates pool nodes in the user's subscription, set this to `UserSubscription`.
23+
- `KeyVaultId`: The resource ID of the Azure key vault associated with the Batch account.
24+
- `KeyVaultUrl`: The URL of the Azure key vault associated with the Batch account.
25+
* Updated parameters to `New-AzureBatchTask`.
26+
- Removed the `RunElevated` switch. The `UserIdentity` parameter has been added to replace `RunElevated`, and the equivalent behavior can be achieved by constructing a `PSUserIdentity` as shown below:
27+
- $autoUser = New-Object Microsoft.Azure.Commands.Batch.Models.PSAutoUserSpecification -ArgumentList @("Task", "Admin")
28+
- $userIdentity = New-Object Microsoft.Azure.Commands.Batch.Models.PSUserIdentity $autoUser
29+
- Added the `AuthenticationTokenSettings` parameter. This parameter allows you to request the Batch service provide an authentication token to the task when it runs, avoiding the need to pass Batch account keys to the task in order to issue requests to the Batch service.
30+
- Added the `ContainerSettings` parameter.
31+
- This parameter allows you to request the Batch service run the task inside a container.
32+
- Added the `OutputFiles` parameter.
33+
- This parameter allows you to configure the task to upload files to Azure Storage after it has finished.
34+
* Updated parameters to `New-AzureBatchPool`.
35+
- Added the `UserAccounts` parameter.
36+
- This parameter defines user accounts created on each node in the pool.
37+
- Added `TargetLowPriorityComputeNodes` and renamed `TargetDedicated` to `TargetDedicatedComputeNodes`.
38+
- A `TargetDedicated` alias was created for the `TargetDedicatedComputeNodes` parameter.
39+
- Added the `NetworkConfiguration` parameter.
40+
- This parameter allows you to configure the pools network settings.
41+
* Updated parameters to `New-AzureBatchCertificate`.
42+
- The `Password` parameter is now a `SecureString`.
43+
* Updated parameters to `New-AzureBatchComputeNodeUser`.
44+
- The `Password` parameter is now a `SecureString`.
45+
* Updated parameters to `Set-AzureBatchComputeNodeUser`.
46+
- The `Password` parameter is now a `SecureString`.
47+
* Renamed the `Name` parameter to `Path` on `Get-AzureBatchNodeFile`, `Get-AzureBatchNodeFileContent`, and `Remove-AzureBatchNodeFile`.
48+
- A `Name` alias was created for the `Path` parameter.
49+
* Changes to objects:
50+
- Removed the `RunElevated` property on `PSCloudTask`, `PSStartTask`, `PSJobManagerTask`, `PSJobPreparationTask`, and `PSJobReleaseTask`. The `UserIdentity` property has been added to replace `RunElevated`. Equivalent behavior to `RunElevated = $true` can be achieved by constructing a `PSUserIdentity` as shown below:
51+
- $autoUser = New-Object Microsoft.Azure.Commands.Batch.Models.PSAutoUserSpecification -ArgumentList @("Task", "Admin")
52+
- $userIdentity = New-Object Microsoft.Azure.Commands.Batch.Models.PSUserIdentity $autoUser
53+
- Added the `AuthenticationTokenSettings` property to `PSCloudTask` and `PSJobManagerTask`.
54+
- Added the `OutputFiles` property to `PSCloudTask`, and `PSJobManagerTask`.
55+
- Added the `ContainerSettings` property to `PSCloudTask`, `PSStartTask`, `PSJobManagerTask`, `PSJobPreparationTask`, and `PSJobReleaseTask`.
56+
- Added the `AllowLowPriorityNode` property to `PSJobManagerTask`.
57+
- Renamed the `SchedulingError` property on `PSJobPreparationTaskExecutionInformation`, `PSJobReleaseTaskExecutionInformation`, `PSStartTaskInformation`, `PSSubtaskInformation`, and `PSTaskExecutionInformation` to `FailureInformation`.
58+
- `FailureInformation` is returned any time there is a task failure. This includes all previous scheduling error cases, as well as nonzero task exit codes, and file upload failures from the new output files feature.
59+
- Renamed `PSTaskSchedulingError` to `PSTaskFailureInformation`.
60+
- Added the `ContainerInformation` and `Result` properties to `PSJobPreparationTaskExecutionInformation`, `PSJobReleaseTaskExecutionInformation`, `PSStartTaskInformation`, `PSSubtaskInformation`, and `PSTaskExecutionInformation`.
61+
- Added the `UserAccounts` property to `PSCloudPool` and `PSPoolSpecification`.
62+
- Added the `TargetLowPriorityComputeNodes` property to `PSCloudPool` and `PSPoolSpecification`, and renamed `TargetDedicated` to `TargetDedicatedComputeNodes`.
63+
- Renamed the `Name` property on `PSNodeFile` to `Path`.
64+
- Added the `EndpointConfiguration` and `IsDedicated` property to `PSComputeNode`.
65+
- Renamed the `SchedulingError` property on `PSExitConditions` to `PreProcessingError`.
66+
- Added the `FileUploadError` to `PSExitConditions`.
67+
- Added the `DependencyAction` property to `PSExitOptions`.
68+
- Added the `OSDisk`, `ContainerConfiguration`, `DataDisks`, and `LicenseType` properties to `PSVirtualMachineConfiguration`.
69+
- Added the `VirtualMachineImageId` property to `PSImageReference`. Note that in order to allow deploying nodes using custom VHDs, the `BatchAccountContext` must be using Azure Active Directory authentication.
70+
- Added the `OnAllTasksComplete` and `OnTaskFailure` properties to `PSJobSpecification`.
71+
- Added the `EndpointConfiguration` property to `PSNetworkConfiguration`.
72+
- Renamed `ResizeError` to `ResizeErrors` on `PSCloudPool`, and it is now a collection.
73+
- `PSMultiInstanceSettings` constructor no longer takes a required `numberOfInstances` parameter, instead it takes a required `coordinationCommandLine` parameter.
74+
75+
* Added support for Azure Active Directory based authentication.
76+
- To use Azure Active Directory authentication, retrieve a `BatchAccountContext` object using the `Get-AzureRmBatchAccount` cmdlet, and supply this `BatchAccountContext` to the `-BatchContext` parameter of a Batch service cmdlet. Azure Active Directory authentication is mandatory for accounts with `PoolAllocationMode = UserSubscription`.
77+
- For existing accounts or for new accounts created with `PoolAllocationMode = BatchService`, you may continue to use shared key authentication by retrieving a `BatchAccountContext` object using the `Get-AzureRmBatchAccoutKeys` cmdlet.
2178

2279
## Version 3.4.1
2380
- Marked cmdlet parameters and type properties obsolete in

src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchAccounts/GetBatchAccountCommandTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public void ListBatchAccountsTest()
5252
BatchAccount accountResource01 = BatchTestHelpers.CreateAccountResource(accountName01, resourceGroup);
5353
string accountName02 = "account02";
5454
BatchAccount accountResource02 = BatchTestHelpers.CreateAccountResource(accountName02, resourceGroup);
55-
BatchAccountContext expected01 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource01);
56-
BatchAccountContext expected02 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource02);
55+
BatchAccountContext expected01 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource01, null);
56+
BatchAccountContext expected02 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource02, null);
5757

5858
batchClientMock.Setup(b => b.ListAccounts(null, resourceGroup)).Returns(new List<BatchAccountContext>() { expected01, expected02 });
5959

@@ -74,7 +74,7 @@ public void GetBatchAccountTest()
7474
string accountName = "account01";
7575
string resourceGroup = "resourceGroup";
7676
BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup);
77-
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource);
77+
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource, null);
7878
batchClientMock.Setup(b => b.GetAccount(resourceGroup, accountName)).Returns(expected);
7979

8080
cmdlet.AccountName = accountName;

src/ResourceManager/AzureBatch/Commands.Batch.Test/BatchAccounts/GetBatchAccountKeysCommandTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void GetBatchAccountKeysTest()
4949
string accountName = "account01";
5050
string resourceGroup = "resourceGroup";
5151
BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup);
52-
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource);
52+
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource, null);
5353
expected.PrimaryAccountKey = primaryKey;
5454
expected.SecondaryAccountKey = secondaryKey;
5555

0 commit comments

Comments
 (0)