Skip to content

Update Batch commandlets to support latest APIs #4762

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

Merged
merged 5 commits into from
Nov 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/ResourceManager/AzureBatch/AzureRM.Batch.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ CmdletsToExport = 'Remove-AzureRmBatchAccount', 'Get-AzureRmBatchAccount',
'New-AzureBatchComputeNodeUser', 'Remove-AzureBatchComputeNodeUser',
'Enable-AzureBatchTask', 'Set-AzureBatchTask', 'Stop-AzureBatchTask',
'Get-AzureBatchComputeNode', 'Get-AzureBatchJobSchedule',
'New-AzureBatchJobSchedule', 'Remove-AzureBatchJobSchedule'
'New-AzureBatchJobSchedule', 'Remove-AzureBatchJobSchedule',
'Get-AzureBatchTaskCounts'

# Variables to export from this module
# VariablesToExport = @()
Expand Down
23 changes: 22 additions & 1 deletion src/ResourceManager/AzureBatch/BatchModelGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ public class Program
private static readonly Dictionary<string, string> OMtoPSClassMappings = new Dictionary<string, string>()
{
{"Microsoft.Azure.Batch.AffinityInformation", "PSAffinityInformation"},
{"Microsoft.Azure.Batch.AuthenticationTokenSettings", "PSAuthenticationTokenSettings"},
{"Microsoft.Azure.Batch.AutoPoolSpecification", "PSAutoPoolSpecification"},
{"Microsoft.Azure.Batch.AutoScaleRun", "PSAutoScaleRun"},
{"Microsoft.Azure.Batch.AutoScaleRunError", "PSAutoScaleRunError"},
{"Microsoft.Azure.Batch.AutoUserSpecification", "PSAutoUserSpecification"},
{"Microsoft.Azure.Batch.ApplicationPackageReference", "PSApplicationPackageReference"},
{"Microsoft.Azure.Batch.Certificate", "PSCertificate"},
{"Microsoft.Azure.Batch.CertificateReference", "PSCertificateReference"},
Expand All @@ -44,9 +46,13 @@ public class Program
{"Microsoft.Azure.Batch.CloudTask", "PSCloudTask"},
{"Microsoft.Azure.Batch.CloudServiceConfiguration", "PSCloudServiceConfiguration"},
{"Microsoft.Azure.Batch.ComputeNode", "PSComputeNode"},
{"Microsoft.Azure.Batch.ComputeNodeEndpointConfiguration", "PSComputeNodeEndpointConfiguration"},
{"Microsoft.Azure.Batch.ComputeNodeError", "PSComputeNodeError"},
{"Microsoft.Azure.Batch.ComputeNodeInformation", "PSComputeNodeInformation"},
{"Microsoft.Azure.Batch.ComputeNodeUser", "PSComputeNodeUser"},
{"Microsoft.Azure.Batch.ContainerConfiguration", "PSContainerConfiguration"},
{"Microsoft.Azure.Batch.ContainerRegistry", "PSContainerRegistry"},
{"Microsoft.Azure.Batch.DataDisk", "PSDataDisk"},
{"Microsoft.Azure.Batch.DeleteCertificateError", "PSDeleteCertificateError"},
{"Microsoft.Azure.Batch.EnvironmentSetting", "PSEnvironmentSetting"},
{"Microsoft.Azure.Batch.ExitConditions", "PSExitConditions"},
Expand All @@ -55,6 +61,8 @@ public class Program
{"Microsoft.Azure.Batch.ExitOptions", "PSExitOptions"},
{"Microsoft.Azure.Batch.FileProperties", "PSFileProperties"},
{"Microsoft.Azure.Batch.ImageReference", "PSImageReference"},
{"Microsoft.Azure.Batch.InboundEndpoint", "PSInboundEndpoint"},
{"Microsoft.Azure.Batch.InboundNatPool", "PSInboundNatPool"},
{"Microsoft.Azure.Batch.RemoteLoginSettings", "PSRemoteLoginSettings"},
{"Microsoft.Azure.Batch.JobConstraints", "PSJobConstraints"},
{"Microsoft.Azure.Batch.JobExecutionInformation", "PSJobExecutionInformation"},
Expand All @@ -69,12 +77,20 @@ public class Program
{"Microsoft.Azure.Batch.JobSchedulingError", "PSJobSchedulingError"},
{"Microsoft.Azure.Batch.JobSpecification", "PSJobSpecification"},
{"Microsoft.Azure.Batch.JobStatistics", "PSJobStatistics"},
{"Microsoft.Azure.Batch.LinuxUserConfiguration", "PSLinuxUserConfiguration"},
{"Microsoft.Azure.Batch.MetadataItem", "PSMetadataItem"},
{"Microsoft.Azure.Batch.MultiInstanceSettings", "PSMultiInstanceSettings"},
{"Microsoft.Azure.Batch.NameValuePair", "PSNameValuePair"},
{"Microsoft.Azure.Batch.NetworkConfiguration", "PSNetworkConfiguration"},
{"Microsoft.Azure.Batch.NetworkSecurityGroupRule", "PSNetworkSecurityGroupRule"},
{"Microsoft.Azure.Batch.NodeAgentSku", "PSNodeAgentSku"},
{"Microsoft.Azure.Batch.NodeFile", "PSNodeFile"},
{"Microsoft.Azure.Batch.OSDisk", "PSOSDisk"},
{"Microsoft.Azure.Batch.OutputFile", "PSOutputFile"},
{"Microsoft.Azure.Batch.OutputFileDestination", "PSOutputFileDestination"},
{"Microsoft.Azure.Batch.OutputFileUploadOptions", "PSOutputFileUploadOptions"},
{"Microsoft.Azure.Batch.OutputFileBlobContainerDestination", "PSOutputFileBlobContainerDestination"},
{"Microsoft.Azure.Batch.PoolEndpointConfiguration", "PSPoolEndpointConfiguration"},
{"Microsoft.Azure.Batch.PoolInformation", "PSPoolInformation"},
{"Microsoft.Azure.Batch.PoolSpecification", "PSPoolSpecification"},
{"Microsoft.Azure.Batch.PoolStatistics", "PSPoolStatistics"},
Expand All @@ -88,14 +104,19 @@ public class Program
{"Microsoft.Azure.Batch.StartTaskInformation", "PSStartTaskInformation"},
{"Microsoft.Azure.Batch.SubtaskInformation", "PSSubtaskInformation"},
{"Microsoft.Azure.Batch.TaskConstraints", "PSTaskConstraints"},
{"Microsoft.Azure.Batch.TaskContainerExecutionInformation", "PSTaskContainerExecutionInformation"},
{"Microsoft.Azure.Batch.TaskContainerSettings", "PSTaskContainerSettings"},
{"Microsoft.Azure.Batch.TaskCounts", "PSTaskCounts"},
{"Microsoft.Azure.Batch.TaskDependencies", "PSTaskDependencies"},
{"Microsoft.Azure.Batch.TaskExecutionInformation", "PSTaskExecutionInformation"},
{"Microsoft.Azure.Batch.TaskInformation", "PSTaskInformation"},
{"Microsoft.Azure.Batch.TaskIdRange", "PSTaskIdRange"},
{"Microsoft.Azure.Batch.TaskSchedulingError", "PSTaskSchedulingError"},
{"Microsoft.Azure.Batch.TaskFailureInformation", "PSTaskFailureInformation"},
{"Microsoft.Azure.Batch.TaskSchedulingPolicy", "PSTaskSchedulingPolicy"},
{"Microsoft.Azure.Batch.TaskStatistics", "PSTaskStatistics"},
{"Microsoft.Azure.Batch.UsageStatistics", "PSUsageStatistics"},
{"Microsoft.Azure.Batch.UserAccount", "PSUserAccount"},
{"Microsoft.Azure.Batch.UserIdentity", "PSUserIdentity"},
{"Microsoft.Azure.Batch.VirtualMachineConfiguration", "PSVirtualMachineConfiguration"},
{"Microsoft.Azure.Batch.WindowsConfiguration", "PSWindowsConfiguration"},
};
Expand Down
57 changes: 57 additions & 0 deletions src/ResourceManager/AzureBatch/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,63 @@
- Additional information about change #1
-->
## Current Release
* Added new parameters to `New-AzureRmBatchAccount`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please ensure that any breakign changes are correctly docuemnted int eh 'Upcoming breaking changes' document (this should have happened on deprecation, but please ensure this is the case now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's updated (I had it in the wrong file but moved it now)

- `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`.
- `KeyVaultId`: The resource ID of the Azure key vault associated with the Batch account.
- `KeyVaultUrl`: The URL of the Azure key vault associated with the Batch account.
* Updated parameters to `New-AzureBatchTask`.
- 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:
- $autoUser = New-Object Microsoft.Azure.Commands.Batch.Models.PSAutoUserSpecification -ArgumentList @("Task", "Admin")
- $userIdentity = New-Object Microsoft.Azure.Commands.Batch.Models.PSUserIdentity $autoUser
- 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.
- Added the `ContainerSettings` parameter.
- This parameter allows you to request the Batch service run the task inside a container.
- Added the `OutputFiles` parameter.
- This parameter allows you to configure the task to upload files to Azure Storage after it has finished.
* Updated parameters to `New-AzureBatchPool`.
- Added the `UserAccounts` parameter.
- This parameter defines user accounts created on each node in the pool.
- Added `TargetLowPriorityComputeNodes` and renamed `TargetDedicated` to `TargetDedicatedComputeNodes`.
- A `TargetDedicated` alias was created for the `TargetDedicatedComputeNodes` parameter.
- Added the `NetworkConfiguration` parameter.
- This parameter allows you to configure the pools network settings.
* Updated parameters to `New-AzureBatchCertificate`.
- The `Password` parameter is now a `SecureString`.
* Updated parameters to `New-AzureBatchComputeNodeUser`.
- The `Password` parameter is now a `SecureString`.
* Updated parameters to `Set-AzureBatchComputeNodeUser`.
- The `Password` parameter is now a `SecureString`.
* Renamed the `Name` parameter to `Path` on `Get-AzureBatchNodeFile`, `Get-AzureBatchNodeFileContent`, and `Remove-AzureBatchNodeFile`.
- A `Name` alias was created for the `Path` parameter.
* Changes to objects:
- 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:
- $autoUser = New-Object Microsoft.Azure.Commands.Batch.Models.PSAutoUserSpecification -ArgumentList @("Task", "Admin")
- $userIdentity = New-Object Microsoft.Azure.Commands.Batch.Models.PSUserIdentity $autoUser
- Added the `AuthenticationTokenSettings` property to `PSCloudTask` and `PSJobManagerTask`.
- Added the `OutputFiles` property to `PSCloudTask`, and `PSJobManagerTask`.
- Added the `ContainerSettings` property to `PSCloudTask`, `PSStartTask`, `PSJobManagerTask`, `PSJobPreparationTask`, and `PSJobReleaseTask`.
- Added the `AllowLowPriorityNode` property to `PSJobManagerTask`.
- Renamed the `SchedulingError` property on `PSJobPreparationTaskExecutionInformation`, `PSJobReleaseTaskExecutionInformation`, `PSStartTaskInformation`, `PSSubtaskInformation`, and `PSTaskExecutionInformation` to `FailureInformation`.
- `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.
- Renamed `PSTaskSchedulingError` to `PSTaskFailureInformation`.
- Added the `ContainerInformation` and `Result` properties to `PSJobPreparationTaskExecutionInformation`, `PSJobReleaseTaskExecutionInformation`, `PSStartTaskInformation`, `PSSubtaskInformation`, and `PSTaskExecutionInformation`.
- Added the `UserAccounts` property to `PSCloudPool` and `PSPoolSpecification`.
- Added the `TargetLowPriorityComputeNodes` property to `PSCloudPool` and `PSPoolSpecification`, and renamed `TargetDedicated` to `TargetDedicatedComputeNodes`.
- Renamed the `Name` property on `PSNodeFile` to `Path`.
- Added the `EndpointConfiguration` and `IsDedicated` property to `PSComputeNode`.
- Renamed the `SchedulingError` property on `PSExitConditions` to `PreProcessingError`.
- Added the `FileUploadError` to `PSExitConditions`.
- Added the `DependencyAction` property to `PSExitOptions`.
- Added the `OSDisk`, `ContainerConfiguration`, `DataDisks`, and `LicenseType` properties to `PSVirtualMachineConfiguration`.
- 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.
- Added the `OnAllTasksComplete` and `OnTaskFailure` properties to `PSJobSpecification`.
- Added the `EndpointConfiguration` property to `PSNetworkConfiguration`.
- Renamed `ResizeError` to `ResizeErrors` on `PSCloudPool`, and it is now a collection.
- `PSMultiInstanceSettings` constructor no longer takes a required `numberOfInstances` parameter, instead it takes a required `coordinationCommandLine` parameter.

* Added support for Azure Active Directory based authentication.
- 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`.
- 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.

## Version 3.4.1
- Marked cmdlet parameters and type properties obsolete in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void ListBatchAccountsTest()
BatchAccount accountResource01 = BatchTestHelpers.CreateAccountResource(accountName01, resourceGroup);
string accountName02 = "account02";
BatchAccount accountResource02 = BatchTestHelpers.CreateAccountResource(accountName02, resourceGroup);
BatchAccountContext expected01 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource01);
BatchAccountContext expected02 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource02);
BatchAccountContext expected01 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource01, null);
BatchAccountContext expected02 = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource02, null);

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

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

cmdlet.AccountName = accountName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void GetBatchAccountKeysTest()
string accountName = "account01";
string resourceGroup = "resourceGroup";
BatchAccount accountResource = BatchTestHelpers.CreateAccountResource(accountName, resourceGroup);
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource);
BatchAccountContext expected = BatchAccountContext.ConvertAccountResourceToNewAccountContext(accountResource, null);
expected.PrimaryAccountKey = primaryKey;
expected.SecondaryAccountKey = secondaryKey;

Expand Down
Loading