Skapar en ny pool i det angivna kontot.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}?api-version=2024-02-01
URI-parametrar
Name |
I |
Obligatorisk |
Typ |
Description |
accountName
|
path |
True
|
string
|
Namnet på Batch-kontot.
Regex pattern: ^[a-zA-Z0-9]+$
|
poolName
|
path |
True
|
string
|
Poolnamnet. Detta måste vara unikt i kontot.
Regex pattern: ^[a-zA-Z0-9_-]+$
|
resourceGroupName
|
path |
True
|
string
|
Namnet på resursgruppen som innehåller Batch-kontot.
|
subscriptionId
|
path |
True
|
string
|
Azure-prenumerations-ID:t. Detta är en GUID-formaterad sträng (t.ex. 000000000-0000-0000-0000-0000000000000000)
|
api-version
|
query |
True
|
string
|
DEN API-version som ska användas med HTTP-begäran.
|
Name |
Obligatorisk |
Typ |
Description |
If-Match
|
|
string
|
Entitetstillståndsversionen (ETag) för poolen som ska uppdateras. Värdet "*" kan endast användas för att tillämpa åtgärden om poolen redan finns. Om den här åtgärden utelämnas tillämpas den alltid.
|
If-None-Match
|
|
string
|
Ange till *för att tillåta att en ny pool skapas, men för att förhindra uppdatering av en befintlig pool. Andra värden ignoreras.
|
Begärandetext
Name |
Typ |
Description |
identity
|
BatchPoolIdentity
|
Den typ av identitet som används för Batch-poolen.
Den typ av identitet som används för Batch-poolen.
|
properties.applicationLicenses
|
string[]
|
Listan över programlicenser som Batch-tjänsten gör tillgängliga på varje beräkningsnod i poolen.
Listan över programlicenser måste vara en delmängd av tillgängliga Batch-tjänstprogramlicenser. Om en licens begärs som inte stöds misslyckas skapandet av poolen.
|
properties.applicationPackages
|
ApplicationPackageReference[]
|
Listan över programpaket som ska installeras på varje beräkningsnod i poolen.
Ändringar av programpaketreferenser påverkar alla nya beräkningsnoder som ansluter till poolen, men påverkar inte beräkningsnoder som redan finns i poolen förrän de startas om eller återskapas. Det finns högst 10 programpaketreferenser i en viss pool.
|
properties.certificates
|
CertificateReference[]
|
Listan över certifikat som ska installeras på varje beräkningsnod i poolen.
För Windows-beräkningsnoder installerar Batch-tjänsten certifikaten till det angivna certifikatarkivet och platsen. För Linux-beräkningsnoder lagras certifikaten i en katalog i aktivitetsarbetskatalogen och en miljövariabel AZ_BATCH_CERTIFICATES_DIR skickas till uppgiften för att fråga efter den här platsen. För certifikat med synlighet för "remoteUser" skapas en "certs"-katalog i användarens hemkatalog (t.ex. /home/{användarnamn}/certifikat) och certifikat placeras i katalogen.
Varning! Den här egenskapen är inaktuell och tas bort efter februari 2024. Använd Azure KeyVault-tillägget i stället.
|
properties.deploymentConfiguration
|
DeploymentConfiguration
|
Den här egenskapen beskriver hur poolnoderna ska distribueras – med hjälp av Cloud Services eller Virtual Machines.
Med CloudServiceConfiguration anges att noderna ska skapas med Azure Cloud Services (PaaS), medan VirtualMachineConfiguration använder Azure Virtual Machines (IaaS).
|
properties.displayName
|
string
|
Visningsnamnet för poolen.
Visningsnamnet behöver inte vara unikt och kan innehålla alla Unicode-tecken upp till en maximal längd på 1024.
|
properties.interNodeCommunication
|
InterNodeCommunicationState
|
Om poolen tillåter direkt kommunikation mellan noder.
Detta medför begränsningar för vilka noder som kan tilldelas till poolen. Om du aktiverar det här värdet kan du minska risken för att det begärda antalet noder allokeras i poolen. Om det inte anges är det här värdet inaktiverat.
|
properties.metadata
|
MetadataItem[]
|
En lista över namn/värde-par som är associerade med poolen som metadata.
Batch-tjänsten tilldelar ingen mening till metadata. det är endast för användning av användarkod.
|
properties.mountConfiguration
|
MountConfiguration[]
|
En lista över filsystem som ska monteras på varje nod i poolen.
Detta stöder Azure Files, NFS, CIFS/SMB och Blobfuse.
|
properties.networkConfiguration
|
NetworkConfiguration
|
Nätverkskonfigurationen för poolen.
Nätverkskonfigurationen för en pool.
|
properties.resourceTags
|
object
|
De användardefinierade taggar som är associerade med poolen.
De användardefinierade taggar som ska associeras med Azure Batch-poolen. När de här taggarna anges sprids de till de Azure-resurser som stöds som är associerade med poolen. Den här egenskapen kan bara anges när Batch-kontot skapades med egenskapen poolAllocationMode inställd på UserSubscription.
|
properties.scaleSettings
|
ScaleSettings
|
Inställningar som konfigurerar antalet noder i poolen.
Definierar poolens önskade storlek. Detta kan antingen vara "fixedScale" där det begärda targetDedicatedNodes har angetts, eller "autoskala" som definierar en formel som regelbundet omvärderas. Om den här egenskapen inte anges har poolen en fast skala med 0 targetDedicatedNodes.
|
properties.startTask
|
StartTask
|
En uppgift som har angetts för att köras på varje beräkningsnod när den ansluter till poolen.
I en PATCH-åtgärd (uppdatering) kan den här egenskapen anges till ett tomt objekt för att ta bort startaktiviteten från poolen.
|
properties.targetNodeCommunicationMode
|
NodeCommunicationMode
|
Önskat nodkommunikationsläge för poolen.
Om det utelämnas är standardvärdet Standard.
|
properties.taskSchedulingPolicy
|
TaskSchedulingPolicy
|
Hur aktiviteter distribueras mellan beräkningsnoder i en pool.
Om det inte anges sprids standardvärdet.
|
properties.taskSlotsPerNode
|
integer
|
Antalet aktivitetsfack som kan användas för att köra samtidiga aktiviteter på en enda beräkningsnod i poolen.
Standardvärdet är 1. Det maximala värdet är mindre än 4 gånger antalet kärnor i vmSize för poolen eller 256.
|
properties.upgradePolicy
|
UpgradePolicy
|
Uppgraderingsprincipen för poolen.
Beskriver en uppgraderingsprincip – automatisk, manuell eller rullande.
|
properties.userAccounts
|
UserAccount[]
|
Listan över användarkonton som ska skapas på varje nod i poolen.
|
properties.vmSize
|
string
|
Storleken på virtuella datorer i poolen. Alla virtuella datorer i en pool har samma storlek.
Information om tillgängliga storlekar på virtuella datorer för Cloud Services pooler (pooler som skapats med cloudServiceConfiguration) finns i Storlekar för Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch stöder alla Cloud Services VM-storlekar utom ExtraSmall. Information om tillgängliga VM-storlekar för pooler med avbildningar från Virtual Machines Marketplace (pooler som skapats med virtualMachineConfiguration) finns i Storlekar för Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) eller Storlekar för Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch stöder alla storlekar på virtuella Azure-datorer utom STANDARD_A0 och de med premiumlagring (STANDARD_GS, STANDARD_DS och STANDARD_DSV2-serien).
|
Svar
Name |
Typ |
Description |
200 OK
|
Pool
|
Åtgärden lyckades. Svaret innehåller poolentiteten.
Headers
ETag: string
|
Other Status Codes
|
CloudError
|
Felsvar som beskriver varför åtgärden misslyckades.
|
Säkerhet
azure_auth
Microsoft Entra autentiseringskodflöde för OAuth 2.0
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
personifiera ditt användarkonto
|
Exempel
CreatePool - accelerated networking
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D1_V2",
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"enableAcceleratedNetworking": true
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_accelerated_networking.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2016-datacenter-smalldisk",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.windows amd64",
}
},
"networkConfiguration": {
"enableAcceleratedNetworking": True,
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "STANDARD_D1_V2",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
func ExamplePoolClient_Create_createPoolAcceleratedNetworking() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2016-datacenter-smalldisk"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
EnableAcceleratedNetworking: to.Ptr(true),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("STANDARD_D1_V2"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB46CB72A227E2\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T03:00:34.064Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](1),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// CurrentNodeCommunicationMode: to.Ptr(armbatch.NodeCommunicationModeClassic),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2016-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// DynamicVNetAssignmentScope: to.Ptr(armbatch.DynamicVNetAssignmentScopeNone),
// EnableAcceleratedNetworking: to.Ptr(true),
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D1_V2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
*/
async function createPoolAcceleratedNetworking() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2016-datacenter-smalldisk",
version: "latest",
},
nodeAgentSkuId: "batch.node.windows amd64",
},
},
networkConfiguration: {
enableAcceleratedNetworking: true,
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "STANDARD_D1_V2",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D1_V2",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "MicrosoftWindowsServer",
Offer = "WindowsServer",
Sku = "2016-datacenter-smalldisk",
Version = "latest",
}, "batch.node.windows amd64"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 1,
TargetLowPriorityNodes = 0,
},
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
EnableAcceleratedNetworking = true,
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB46CB72A227E2"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB46CB72A227E2\"",
"properties": {
"lastModified": "2023-04-27T02:59:41.8592226Z",
"creationTime": "2023-04-27T02:59:41.8592226Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-04-27T02:59:41.8592226Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2023-04-27T03:00:34.0646502Z",
"vmSize": "STANDARD_D1_V2",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64"
}
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"dynamicVnetAssignmentScope": "none",
"enableAcceleratedNetworking": true
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-04-27T02:59:41.8592226Z"
},
"currentDedicatedNodes": 1,
"currentLowPriorityNodes": 0,
"currentNodeCommunicationMode": "Classic"
}
}
CreatePool - Custom Image
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_shared_image_gallery.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
func ExamplePoolClient_Create_createPoolCustomImage() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// TargetDedicatedNodes: to.Ptr[int32](0),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
*/
async function createPoolCustomImage() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
}, "batch.node.ubuntu 18.04"),
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 0,
"targetLowPriorityNodes": 0
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Full CloudServiceConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"displayName": "my-pool-name",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Enabled",
"taskSlotsPerNode": 13,
"taskSchedulingPolicy": {
"nodeFillType": "Pack"
},
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "4",
"osVersion": "WA-GUEST-OS-4.45_201708-01"
}
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"
]
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 6,
"targetLowPriorityNodes": 28,
"resizeTimeout": "PT8M",
"nodeDeallocationOption": "TaskCompletion"
}
},
"metadata": [
{
"name": "metadata-1",
"value": "value-1"
},
{
"name": "metadata-2",
"value": "value-2"
}
],
"startTask": {
"commandLine": "cmd /c SET",
"resourceFiles": [
{
"httpUrl": "https://testaccount.blob.core.windows.net/example-blob-file",
"filePath": "c:\\temp\\gohere",
"fileMode": "777"
}
],
"environmentSettings": [
{
"name": "MYSET",
"value": "1234"
}
],
"userIdentity": {
"autoUser": {
"scope": "Pool",
"elevationLevel": "Admin"
}
},
"maxTaskRetryCount": 6,
"waitForSuccess": true
},
"userAccounts": [
{
"name": "username1",
"password": "<ExamplePassword>",
"elevationLevel": "Admin",
"linuxUserConfiguration": {
"sshPrivateKey": "sshprivatekeyvalue",
"uid": 1234,
"gid": 4567
}
}
],
"applicationPackages": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
"version": "asdf"
}
],
"certificates": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
"storeLocation": "LocalMachine",
"storeName": "MY",
"visibility": [
"RemoteUser"
]
}
],
"applicationLicenses": [
"app-license0",
"app-license1"
]
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_cloud_service_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"applicationLicenses": ["app-license0", "app-license1"],
"applicationPackages": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
"version": "asdf",
}
],
"certificates": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
"storeLocation": "LocalMachine",
"storeName": "MY",
"visibility": ["RemoteUser"],
}
],
"deploymentConfiguration": {
"cloudServiceConfiguration": {"osFamily": "4", "osVersion": "WA-GUEST-OS-4.45_201708-01"}
},
"displayName": "my-pool-name",
"interNodeCommunication": "Enabled",
"metadata": [{"name": "metadata-1", "value": "value-1"}, {"name": "metadata-2", "value": "value-2"}],
"networkConfiguration": {
"publicIPAddressConfiguration": {
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268",
],
"provision": "UserManaged",
},
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"scaleSettings": {
"fixedScale": {
"nodeDeallocationOption": "TaskCompletion",
"resizeTimeout": "PT8M",
"targetDedicatedNodes": 6,
"targetLowPriorityNodes": 28,
}
},
"startTask": {
"commandLine": "cmd /c SET",
"environmentSettings": [{"name": "MYSET", "value": "1234"}],
"maxTaskRetryCount": 6,
"resourceFiles": [
{
"fileMode": "777",
"filePath": "c:\\temp\\gohere",
"httpUrl": "https://testaccount.blob.core.windows.net/example-blob-file",
}
],
"userIdentity": {"autoUser": {"elevationLevel": "Admin", "scope": "Pool"}},
"waitForSuccess": True,
},
"taskSchedulingPolicy": {"nodeFillType": "Pack"},
"taskSlotsPerNode": 13,
"userAccounts": [
{
"elevationLevel": "Admin",
"linuxUserConfiguration": {"gid": 4567, "sshPrivateKey": "sshprivatekeyvalue", "uid": 1234},
"name": "username1",
"password": "<ExamplePassword>",
}
],
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
func ExamplePoolClient_Create_createPoolFullCloudServiceConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
ApplicationLicenses: []*string{
to.Ptr("app-license0"),
to.Ptr("app-license1")},
ApplicationPackages: []*armbatch.ApplicationPackageReference{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234"),
Version: to.Ptr("asdf"),
}},
Certificates: []*armbatch.CertificateReference{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567"),
StoreLocation: to.Ptr(armbatch.CertificateStoreLocationLocalMachine),
StoreName: to.Ptr("MY"),
Visibility: []*armbatch.CertificateVisibility{
to.Ptr(armbatch.CertificateVisibilityRemoteUser)},
}},
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
OSFamily: to.Ptr("4"),
OSVersion: to.Ptr("WA-GUEST-OS-4.45_201708-01"),
},
},
DisplayName: to.Ptr("my-pool-name"),
InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateEnabled),
Metadata: []*armbatch.MetadataItem{
{
Name: to.Ptr("metadata-1"),
Value: to.Ptr("value-1"),
},
{
Name: to.Ptr("metadata-2"),
Value: to.Ptr("value-2"),
}},
NetworkConfiguration: &armbatch.NetworkConfiguration{
PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
IPAddressIDs: []*string{
to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"),
to.Ptr("/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268")},
Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
},
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionTaskCompletion),
ResizeTimeout: to.Ptr("PT8M"),
TargetDedicatedNodes: to.Ptr[int32](6),
TargetLowPriorityNodes: to.Ptr[int32](28),
},
},
StartTask: &armbatch.StartTask{
CommandLine: to.Ptr("cmd /c SET"),
EnvironmentSettings: []*armbatch.EnvironmentSetting{
{
Name: to.Ptr("MYSET"),
Value: to.Ptr("1234"),
}},
MaxTaskRetryCount: to.Ptr[int32](6),
ResourceFiles: []*armbatch.ResourceFile{
{
FileMode: to.Ptr("777"),
FilePath: to.Ptr("c:\\temp\\gohere"),
HTTPURL: to.Ptr("https://testaccount.blob.core.windows.net/example-blob-file"),
}},
UserIdentity: &armbatch.UserIdentity{
AutoUser: &armbatch.AutoUserSpecification{
ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
Scope: to.Ptr(armbatch.AutoUserScopePool),
},
},
WaitForSuccess: to.Ptr(true),
},
TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypePack),
},
TaskSlotsPerNode: to.Ptr[int32](13),
UserAccounts: []*armbatch.UserAccount{
{
Name: to.Ptr("username1"),
ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
LinuxUserConfiguration: &armbatch.LinuxUserConfiguration{
Gid: to.Ptr[int32](4567),
SSHPrivateKey: to.Ptr("sshprivatekeyvalue"),
UID: to.Ptr[int32](1234),
},
Password: to.Ptr("<ExamplePassword>"),
}},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ApplicationLicenses: []*string{
// to.Ptr("app-license0"),
// to.Ptr("app-license1")},
// ApplicationPackages: []*armbatch.ApplicationPackageReference{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234"),
// Version: to.Ptr("asdf"),
// }},
// Certificates: []*armbatch.CertificateReference{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567"),
// StoreLocation: to.Ptr(armbatch.CertificateStoreLocationLocalMachine),
// StoreName: to.Ptr("MY"),
// Visibility: []*armbatch.CertificateVisibility{
// to.Ptr(armbatch.CertificateVisibilityRemoteUser)},
// }},
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
// OSFamily: to.Ptr("4"),
// OSVersion: to.Ptr("WA-GUEST-OS-4.45_201708-01"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateEnabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// Metadata: []*armbatch.MetadataItem{
// {
// Name: to.Ptr("metadata-1"),
// Value: to.Ptr("value-1"),
// },
// {
// Name: to.Ptr("metadata-2"),
// Value: to.Ptr("value-2"),
// }},
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
// IPAddressIDs: []*string{
// to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"),
// to.Ptr("/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268")},
// Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
// },
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionTaskCompletion),
// ResizeTimeout: to.Ptr("PT8M"),
// TargetDedicatedNodes: to.Ptr[int32](6),
// TargetLowPriorityNodes: to.Ptr[int32](28),
// },
// },
// StartTask: &armbatch.StartTask{
// CommandLine: to.Ptr("cmd /c SET"),
// EnvironmentSettings: []*armbatch.EnvironmentSetting{
// {
// Name: to.Ptr("MYSET"),
// Value: to.Ptr("1234"),
// }},
// MaxTaskRetryCount: to.Ptr[int32](6),
// ResourceFiles: []*armbatch.ResourceFile{
// {
// FileMode: to.Ptr("777"),
// FilePath: to.Ptr("c:\\temp\\gohere"),
// HTTPURL: to.Ptr("https://testaccount.blob.core.windows.net/example-blob-file"),
// }},
// UserIdentity: &armbatch.UserIdentity{
// AutoUser: &armbatch.AutoUserSpecification{
// ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
// Scope: to.Ptr(armbatch.AutoUserScopePool),
// },
// },
// WaitForSuccess: to.Ptr(true),
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypePack),
// },
// TaskSlotsPerNode: to.Ptr[int32](13),
// UserAccounts: []*armbatch.UserAccount{
// {
// Name: to.Ptr("username1"),
// ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
// LinuxUserConfiguration: &armbatch.LinuxUserConfiguration{
// Gid: to.Ptr[int32](4567),
// UID: to.Ptr[int32](1234),
// },
// }},
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
*/
async function createPoolFullCloudServiceConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
applicationLicenses: ["app-license0", "app-license1"],
applicationPackages: [
{
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
version: "asdf",
},
],
certificates: [
{
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
storeLocation: "LocalMachine",
storeName: "MY",
visibility: ["RemoteUser"],
},
],
deploymentConfiguration: {
cloudServiceConfiguration: {
osFamily: "4",
osVersion: "WA-GUEST-OS-4.45_201708-01",
},
},
displayName: "my-pool-name",
interNodeCommunication: "Enabled",
metadata: [
{ name: "metadata-1", value: "value-1" },
{ name: "metadata-2", value: "value-2" },
],
networkConfiguration: {
publicIPAddressConfiguration: {
ipAddressIds: [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268",
],
provision: "UserManaged",
},
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
scaleSettings: {
fixedScale: {
nodeDeallocationOption: "TaskCompletion",
resizeTimeout: "PT8M",
targetDedicatedNodes: 6,
targetLowPriorityNodes: 28,
},
},
startTask: {
commandLine: "cmd /c SET",
environmentSettings: [{ name: "MYSET", value: "1234" }],
maxTaskRetryCount: 6,
resourceFiles: [
{
fileMode: "777",
filePath: "c:\\temp\\gohere",
httpUrl: "https://testaccount.blob.core.windows.net/example-blob-file",
},
],
userIdentity: { autoUser: { elevationLevel: "Admin", scope: "Pool" } },
waitForSuccess: true,
},
taskSchedulingPolicy: { nodeFillType: "Pack" },
taskSlotsPerNode: 13,
userAccounts: [
{
name: "username1",
elevationLevel: "Admin",
linuxUserConfiguration: {
gid: 4567,
sshPrivateKey: "sshprivatekeyvalue",
uid: 1234,
},
password: "<ExamplePassword>",
},
],
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
DisplayName = "my-pool-name",
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
CloudServiceConfiguration = new BatchCloudServiceConfiguration("4")
{
OSVersion = "WA-GUEST-OS-4.45_201708-01",
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
ResizeTimeout = XmlConvert.ToTimeSpan("PT8M"),
TargetDedicatedNodes = 6,
TargetLowPriorityNodes = 28,
NodeDeallocationOption = BatchNodeDeallocationOption.TaskCompletion,
},
},
InterNodeCommunication = InterNodeCommunicationState.Enabled,
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
PublicIPAddressConfiguration = new BatchPublicIPAddressConfiguration()
{
Provision = BatchIPAddressProvisioningType.UserManaged,
IPAddressIds =
{
new ResourceIdentifier("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"),new ResourceIdentifier("/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268")
},
},
},
TaskSlotsPerNode = 13,
TaskSchedulingNodeFillType = BatchNodeFillType.Pack,
UserAccounts =
{
new BatchUserAccount("username1","<ExamplePassword>")
{
ElevationLevel = BatchUserAccountElevationLevel.Admin,
LinuxUserConfiguration = new BatchLinuxUserConfiguration()
{
Uid = 1234,
Gid = 4567,
SshPrivateKey = "sshprivatekeyvalue",
},
}
},
Metadata =
{
new BatchAccountPoolMetadataItem("metadata-1","value-1"),new BatchAccountPoolMetadataItem("metadata-2","value-2")
},
StartTask = new BatchAccountPoolStartTask()
{
CommandLine = "cmd /c SET",
ResourceFiles =
{
new BatchResourceFile()
{
HttpUri = new Uri("https://testaccount.blob.core.windows.net/example-blob-file"),
FilePath = "c:\\temp\\gohere",
FileMode = "777",
}
},
EnvironmentSettings =
{
new BatchEnvironmentSetting("MYSET")
{
Value = "1234",
}
},
UserIdentity = new BatchUserIdentity()
{
AutoUser = new BatchAutoUserSpecification()
{
Scope = BatchAutoUserScope.Pool,
ElevationLevel = BatchUserAccountElevationLevel.Admin,
},
},
MaxTaskRetryCount = 6,
WaitForSuccess = true,
},
Certificates =
{
new BatchCertificateReference(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567"))
{
StoreLocation = BatchCertificateStoreLocation.LocalMachine,
StoreName = "MY",
Visibility =
{
BatchCertificateVisibility.RemoteUser
},
}
},
ApplicationPackages =
{
new BatchApplicationPackageReference(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234"))
{
Version = "asdf",
}
},
ApplicationLicenses =
{
"app-license0","app-license1"
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Enabled",
"taskSlotsPerNode": 13,
"taskSchedulingPolicy": {
"nodeFillType": "Pack"
},
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "4",
"osVersion": "WA-GUEST-OS-4.45_201708-01"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 6,
"targetLowPriorityNodes": 28,
"resizeTimeout": "PT8M",
"nodeDeallocationOption": "TaskCompletion"
}
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"
]
}
},
"metadata": [
{
"name": "metadata-1",
"value": "value-1"
},
{
"name": "metadata-2",
"value": "value-2"
}
],
"startTask": {
"commandLine": "cmd /c SET",
"resourceFiles": [
{
"httpUrl": "https://testaccount.blob.core.windows.net/example-blob-file",
"filePath": "c:\\temp\\gohere",
"fileMode": "777"
}
],
"environmentSettings": [
{
"name": "MYSET",
"value": "1234"
}
],
"userIdentity": {
"autoUser": {
"scope": "Pool",
"elevationLevel": "Admin"
}
},
"maxTaskRetryCount": 6,
"waitForSuccess": true
},
"userAccounts": [
{
"name": "username1",
"elevationLevel": "Admin",
"linuxUserConfiguration": {
"uid": 1234,
"gid": 4567
}
}
],
"applicationPackages": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
"version": "asdf"
}
],
"certificates": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
"storeLocation": "LocalMachine",
"storeName": "MY",
"visibility": [
"RemoteUser"
]
}
],
"applicationLicenses": [
"app-license0",
"app-license1"
],
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Full VirtualMachineConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter-SmallDisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"licenseType": "Windows_Server",
"dataDisks": [
{
"lun": 0,
"caching": "ReadWrite",
"diskSizeGB": 30,
"storageAccountType": "Premium_LRS"
},
{
"lun": 1,
"caching": "None",
"diskSizeGB": 200,
"storageAccountType": "Standard_LRS"
}
],
"diskEncryptionConfiguration": {
"targets": [
"OsDisk",
"TemporaryDisk"
]
},
"nodePlacementConfiguration": {
"policy": "Zonal"
},
"osDisk": {
"ephemeralOSDiskSettings": {
"placement": "CacheDisk"
}
}
}
},
"networkConfiguration": {
"endpointConfiguration": {
"inboundNatPools": [
{
"name": "testnat",
"protocol": "TCP",
"backendPort": 12001,
"frontendPortRangeStart": 15000,
"frontendPortRangeEnd": 15100,
"networkSecurityGroupRules": [
{
"access": "Allow",
"sourceAddressPrefix": "192.100.12.45",
"priority": 150,
"sourcePortRanges": [
"1",
"2"
]
},
{
"access": "Deny",
"sourceAddressPrefix": "*",
"priority": 3500,
"sourcePortRanges": [
"*"
]
}
]
}
]
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"dataDisks": [
{"caching": "ReadWrite", "diskSizeGB": 30, "lun": 0, "storageAccountType": "Premium_LRS"},
{"caching": "None", "diskSizeGB": 200, "lun": 1, "storageAccountType": "Standard_LRS"},
],
"diskEncryptionConfiguration": {"targets": ["OsDisk", "TemporaryDisk"]},
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2016-Datacenter-SmallDisk",
"version": "latest",
},
"licenseType": "Windows_Server",
"nodeAgentSkuId": "batch.node.windows amd64",
"nodePlacementConfiguration": {"policy": "Zonal"},
"osDisk": {"ephemeralOSDiskSettings": {"placement": "CacheDisk"}},
"windowsConfiguration": {"enableAutomaticUpdates": False},
}
},
"networkConfiguration": {
"endpointConfiguration": {
"inboundNatPools": [
{
"backendPort": 12001,
"frontendPortRangeEnd": 15100,
"frontendPortRangeStart": 15000,
"name": "testnat",
"networkSecurityGroupRules": [
{
"access": "Allow",
"priority": 150,
"sourceAddressPrefix": "192.100.12.45",
"sourcePortRanges": ["1", "2"],
},
{
"access": "Deny",
"priority": 3500,
"sourceAddressPrefix": "*",
"sourcePortRanges": ["*"],
},
],
"protocol": "TCP",
}
]
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
func ExamplePoolClient_Create_createPoolFullVirtualMachineConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
DataDisks: []*armbatch.DataDisk{
{
Caching: to.Ptr(armbatch.CachingTypeReadWrite),
DiskSizeGB: to.Ptr[int32](30),
Lun: to.Ptr[int32](0),
StorageAccountType: to.Ptr(armbatch.StorageAccountTypePremiumLRS),
},
{
Caching: to.Ptr(armbatch.CachingTypeNone),
DiskSizeGB: to.Ptr[int32](200),
Lun: to.Ptr[int32](1),
StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardLRS),
}},
DiskEncryptionConfiguration: &armbatch.DiskEncryptionConfiguration{
Targets: []*armbatch.DiskEncryptionTarget{
to.Ptr(armbatch.DiskEncryptionTargetOsDisk),
to.Ptr(armbatch.DiskEncryptionTargetTemporaryDisk)},
},
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2016-Datacenter-SmallDisk"),
Version: to.Ptr("latest"),
},
LicenseType: to.Ptr("Windows_Server"),
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
},
OSDisk: &armbatch.OSDisk{
EphemeralOSDiskSettings: &armbatch.DiffDiskSettings{
Placement: to.Ptr("CacheDisk"),
},
},
WindowsConfiguration: &armbatch.WindowsConfiguration{
EnableAutomaticUpdates: to.Ptr(false),
},
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
EndpointConfiguration: &armbatch.PoolEndpointConfiguration{
InboundNatPools: []*armbatch.InboundNatPool{
{
Name: to.Ptr("testnat"),
BackendPort: to.Ptr[int32](12001),
FrontendPortRangeEnd: to.Ptr[int32](15100),
FrontendPortRangeStart: to.Ptr[int32](15000),
NetworkSecurityGroupRules: []*armbatch.NetworkSecurityGroupRule{
{
Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessAllow),
Priority: to.Ptr[int32](150),
SourceAddressPrefix: to.Ptr("192.100.12.45"),
SourcePortRanges: []*string{
to.Ptr("1"),
to.Ptr("2")},
},
{
Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessDeny),
Priority: to.Ptr[int32](3500),
SourceAddressPrefix: to.Ptr("*"),
SourcePortRanges: []*string{
to.Ptr("*")},
}},
Protocol: to.Ptr(armbatch.InboundEndpointProtocolTCP),
}},
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// DataDisks: []*armbatch.DataDisk{
// {
// Caching: to.Ptr(armbatch.CachingTypeReadWrite),
// DiskSizeGB: to.Ptr[int32](30),
// Lun: to.Ptr[int32](0),
// StorageAccountType: to.Ptr(armbatch.StorageAccountTypePremiumLRS),
// },
// {
// Caching: to.Ptr(armbatch.CachingTypeNone),
// DiskSizeGB: to.Ptr[int32](200),
// Lun: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardLRS),
// }},
// DiskEncryptionConfiguration: &armbatch.DiskEncryptionConfiguration{
// Targets: []*armbatch.DiskEncryptionTarget{
// to.Ptr(armbatch.DiskEncryptionTargetOsDisk),
// to.Ptr(armbatch.DiskEncryptionTargetTemporaryDisk)},
// },
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2016-Datacenter-SmallDisk"),
// Version: to.Ptr("latest"),
// },
// LicenseType: to.Ptr("Windows_Server"),
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
// Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
// },
// WindowsConfiguration: &armbatch.WindowsConfiguration{
// EnableAutomaticUpdates: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// EndpointConfiguration: &armbatch.PoolEndpointConfiguration{
// InboundNatPools: []*armbatch.InboundNatPool{
// {
// Name: to.Ptr("testnat"),
// BackendPort: to.Ptr[int32](12001),
// FrontendPortRangeEnd: to.Ptr[int32](15100),
// FrontendPortRangeStart: to.Ptr[int32](15000),
// NetworkSecurityGroupRules: []*armbatch.NetworkSecurityGroupRule{
// {
// Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessAllow),
// Priority: to.Ptr[int32](150),
// SourceAddressPrefix: to.Ptr("192.100.12.45"),
// SourcePortRanges: []*string{
// to.Ptr("1"),
// to.Ptr("2")},
// },
// {
// Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessDeny),
// Priority: to.Ptr[int32](3500),
// SourceAddressPrefix: to.Ptr("*"),
// SourcePortRanges: []*string{
// to.Ptr("*")},
// }},
// Protocol: to.Ptr(armbatch.InboundEndpointProtocolTCP),
// }},
// },
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
*/
async function createPoolFullVirtualMachineConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
dataDisks: [
{
caching: "ReadWrite",
diskSizeGB: 30,
lun: 0,
storageAccountType: "Premium_LRS",
},
{
caching: "None",
diskSizeGB: 200,
lun: 1,
storageAccountType: "Standard_LRS",
},
],
diskEncryptionConfiguration: { targets: ["OsDisk", "TemporaryDisk"] },
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2016-Datacenter-SmallDisk",
version: "latest",
},
licenseType: "Windows_Server",
nodeAgentSkuId: "batch.node.windows amd64",
nodePlacementConfiguration: { policy: "Zonal" },
osDisk: { ephemeralOSDiskSettings: { placement: "CacheDisk" } },
windowsConfiguration: { enableAutomaticUpdates: false },
},
},
networkConfiguration: {
endpointConfiguration: {
inboundNatPools: [
{
name: "testnat",
backendPort: 12001,
frontendPortRangeEnd: 15100,
frontendPortRangeStart: 15000,
networkSecurityGroupRules: [
{
access: "Allow",
priority: 150,
sourceAddressPrefix: "192.100.12.45",
sourcePortRanges: ["1", "2"],
},
{
access: "Deny",
priority: 3500,
sourceAddressPrefix: "*",
sourcePortRanges: ["*"],
},
],
protocol: "TCP",
},
],
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "MicrosoftWindowsServer",
Offer = "WindowsServer",
Sku = "2016-Datacenter-SmallDisk",
Version = "latest",
}, "batch.node.windows amd64")
{
IsAutomaticUpdateEnabled = false,
DataDisks =
{
new BatchVmDataDisk(0,30)
{
Caching = BatchDiskCachingType.ReadWrite,
StorageAccountType = BatchStorageAccountType.PremiumLrs,
},new BatchVmDataDisk(1,200)
{
Caching = BatchDiskCachingType.None,
StorageAccountType = BatchStorageAccountType.StandardLrs,
}
},
LicenseType = "Windows_Server",
DiskEncryptionTargets =
{
BatchDiskEncryptionTarget.OSDisk,BatchDiskEncryptionTarget.TemporaryDisk
},
NodePlacementPolicy = BatchNodePlacementPolicyType.Zonal,
EphemeralOSDiskPlacement = BatchDiffDiskPlacement.CacheDisk,
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
EndpointInboundNatPools =
{
new BatchInboundNatPool("testnat",BatchInboundEndpointProtocol.Tcp,12001,15000,15100)
{
NetworkSecurityGroupRules =
{
new BatchNetworkSecurityGroupRule(150,BatchNetworkSecurityGroupRuleAccess.Allow,"192.100.12.45")
{
SourcePortRanges =
{
"1","2"
},
},new BatchNetworkSecurityGroupRule(3500,BatchNetworkSecurityGroupRuleAccess.Deny,"*")
{
SourcePortRanges =
{
"*"
},
}
},
}
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter-SmallDisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"licenseType": "Windows_Server",
"dataDisks": [
{
"lun": 0,
"caching": "ReadWrite",
"diskSizeGB": 30,
"storageAccountType": "Premium_LRS"
},
{
"lun": 1,
"caching": "None",
"diskSizeGB": 200,
"storageAccountType": "Standard_LRS"
}
],
"diskEncryptionConfiguration": {
"targets": [
"OsDisk",
"TemporaryDisk"
]
},
"nodePlacementConfiguration": {
"policy": "Zonal"
}
}
},
"networkConfiguration": {
"endpointConfiguration": {
"inboundNatPools": [
{
"name": "testnat",
"protocol": "TCP",
"backendPort": 12001,
"frontendPortRangeStart": 15000,
"frontendPortRangeEnd": 15100,
"networkSecurityGroupRules": [
{
"access": "Allow",
"sourceAddressPrefix": "192.100.12.45",
"priority": 150,
"sourcePortRanges": [
"1",
"2"
]
},
{
"access": "Deny",
"sourceAddressPrefix": "*",
"priority": 3500,
"sourcePortRanges": [
"*"
]
}
]
}
]
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Minimal CloudServiceConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "5"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 3
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_minimal_cloud_service_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {"cloudServiceConfiguration": {"osFamily": "5"}},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 3}},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
func ExamplePoolClient_Create_createPoolMinimalCloudServiceConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
OSFamily: to.Ptr("5"),
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](3),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
// OSFamily: to.Ptr("5"),
// OSVersion: to.Ptr("*"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](3),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](3),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
*/
async function createPoolMinimalCloudServiceConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: { cloudServiceConfiguration: { osFamily: "5" } },
scaleSettings: { fixedScale: { targetDedicatedNodes: 3 } },
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
CloudServiceConfiguration = new BatchCloudServiceConfiguration("5"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 3,
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "5",
"osVersion": "*"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 3,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"resizeOperationStatus": {
"startTime": "2017-08-28T10:22:55.9407275Z",
"targetDedicatedNodes": 3,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M"
}
}
}
CreatePool - Minimal VirtualMachineConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_minimal_virtual_machine_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18.04-LTS",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
func ExamplePoolClient_Create_createPoolMinimalVirtualMachineConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18.04-LTS"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18.04-LTS"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
*/
async function createPoolMinimalVirtualMachineConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18.04-LTS",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "18.04-LTS",
Version = "latest",
}, "batch.node.ubuntu 18.04"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - No public IP
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "NoPublicIPAddresses"
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_no_public_ip_addresses.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"networkConfiguration": {
"publicIPAddressConfiguration": {"provision": "NoPublicIPAddresses"},
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
func ExamplePoolClient_Create_createPoolNoPublicIp() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
Provision: to.Ptr(armbatch.IPAddressProvisioningTypeNoPublicIPAddresses),
},
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
// Provision: to.Ptr(armbatch.IPAddressProvisioningTypeNoPublicIPAddresses),
// },
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// TargetDedicatedNodes: to.Ptr[int32](0),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
*/
async function createPoolNoPublicIP() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
networkConfiguration: {
publicIPAddressConfiguration: { provision: "NoPublicIPAddresses" },
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
}, "batch.node.ubuntu 18.04"),
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
PublicIPAddressConfiguration = new BatchPublicIPAddressConfiguration()
{
Provision = BatchIPAddressProvisioningType.NoPublicIPAddresses,
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "NoPublicIPAddresses"
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 0,
"targetLowPriorityNodes": 0
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Public IPs
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"
]
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_public_ips.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"networkConfiguration": {
"publicIPAddressConfiguration": {
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"
],
"provision": "UserManaged",
},
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
func ExamplePoolClient_Create_createPoolPublicIPs() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
IPAddressIDs: []*string{
to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135")},
Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
},
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
// IPAddressIDs: []*string{
// to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135")},
// Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
// },
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// TargetDedicatedNodes: to.Ptr[int32](0),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
*/
async function createPoolPublicIPs() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
networkConfiguration: {
publicIPAddressConfiguration: {
ipAddressIds: [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
],
provision: "UserManaged",
},
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
}, "batch.node.ubuntu 18.04"),
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
PublicIPAddressConfiguration = new BatchPublicIPAddressConfiguration()
{
Provision = BatchIPAddressProvisioningType.UserManaged,
IPAddressIds =
{
new ResourceIdentifier("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135")
},
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"
]
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 0,
"targetLowPriorityNodes": 0
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"resourceTags": {
"TagName1": "TagValue1",
"TagName2": "TagValue2"
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_resource_tags.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18_04-lts-gen2",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"resourceTags": {"TagName1": "TagValue1", "TagName2": "TagValue2"},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
func ExamplePoolClient_Create_createPoolResourceTags() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18_04-lts-gen2"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
ResourceTags: map[string]*string{
"TagName1": to.Ptr("TagValue1"),
"TagName2": to.Ptr("TagValue2"),
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB554F8E08BCF4\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18_04-lts-gen2"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-27T07:33:13.062Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ResourceTags: map[string]*string{
// "TagName1": to.Ptr("TagValue1"),
// "TagName2": to.Ptr("TagValue2"),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
*/
async function createPoolResourceTags() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18_04-lts-gen2",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
resourceTags: { tagName1: "TagValue1", tagName2: "TagValue2" },
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB554F8E08BCF4"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB554F8E08BCF4\"",
"properties": {
"lastModified": "2023-06-14T07:03:58.3231917Z",
"creationTime": "2023-06-14T07:03:58.3231917Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-09-27T07:33:13.0625789Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"resourceTags": {
"TagName1": "TagValue1",
"TagName2": "TagValue2"
}
}
}
CreatePool - SecurityProfile
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
"securityProfile": {
"securityType": "trustedLaunch",
"encryptionAtHost": true,
"uefiSettings": {
"secureBootEnabled": null,
"vTpmEnabled": false
}
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_security_profile.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18_04-lts-gen2",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
"securityProfile": {
"encryptionAtHost": True,
"securityType": "trustedLaunch",
"uefiSettings": {"secureBootEnabled": None, "vTpmEnabled": False},
},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
func ExamplePoolClient_Create_createPoolSecurityProfile() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18_04-lts-gen2"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
SecurityProfile: &armbatch.SecurityProfile{
EncryptionAtHost: to.Ptr(true),
SecurityType: to.Ptr("trustedLaunch"),
UefiSettings: &armbatch.UefiSettings{
VTpmEnabled: to.Ptr(false),
},
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB554F8E08BCF4\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18_04-lts-gen2"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// SecurityProfile: &armbatch.SecurityProfile{
// EncryptionAtHost: to.Ptr(true),
// SecurityType: to.Ptr("trustedLaunch"),
// UefiSettings: &armbatch.UefiSettings{
// VTpmEnabled: to.Ptr(false),
// },
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
*/
async function createPoolSecurityProfile() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18_04-lts-gen2",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
securityProfile: {
encryptionAtHost: true,
securityType: "trustedLaunch",
uefiSettings: { secureBootEnabled: undefined, vTpmEnabled: false },
},
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.batch.models.ApplicationPackageReference;
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.AutoUserScope;
import com.azure.resourcemanager.batch.models.AutoUserSpecification;
import com.azure.resourcemanager.batch.models.AutomaticOSUpgradePolicy;
import com.azure.resourcemanager.batch.models.BatchPoolIdentity;
import com.azure.resourcemanager.batch.models.CachingType;
import com.azure.resourcemanager.batch.models.CertificateReference;
import com.azure.resourcemanager.batch.models.CertificateStoreLocation;
import com.azure.resourcemanager.batch.models.CertificateVisibility;
import com.azure.resourcemanager.batch.models.CloudServiceConfiguration;
import com.azure.resourcemanager.batch.models.ComputeNodeDeallocationOption;
import com.azure.resourcemanager.batch.models.ComputeNodeFillType;
import com.azure.resourcemanager.batch.models.DataDisk;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.DiffDiskPlacement;
import com.azure.resourcemanager.batch.models.DiffDiskSettings;
import com.azure.resourcemanager.batch.models.DiskEncryptionConfiguration;
import com.azure.resourcemanager.batch.models.DiskEncryptionTarget;
import com.azure.resourcemanager.batch.models.ElevationLevel;
import com.azure.resourcemanager.batch.models.EnvironmentSetting;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.InboundEndpointProtocol;
import com.azure.resourcemanager.batch.models.InboundNatPool;
import com.azure.resourcemanager.batch.models.InterNodeCommunicationState;
import com.azure.resourcemanager.batch.models.IpAddressProvisioningType;
import com.azure.resourcemanager.batch.models.LinuxUserConfiguration;
import com.azure.resourcemanager.batch.models.ManagedDisk;
import com.azure.resourcemanager.batch.models.MetadataItem;
import com.azure.resourcemanager.batch.models.NetworkConfiguration;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRule;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRuleAccess;
import com.azure.resourcemanager.batch.models.NodeCommunicationMode;
import com.azure.resourcemanager.batch.models.NodePlacementConfiguration;
import com.azure.resourcemanager.batch.models.NodePlacementPolicyType;
import com.azure.resourcemanager.batch.models.OSDisk;
import com.azure.resourcemanager.batch.models.PoolEndpointConfiguration;
import com.azure.resourcemanager.batch.models.PoolIdentityType;
import com.azure.resourcemanager.batch.models.PublicIpAddressConfiguration;
import com.azure.resourcemanager.batch.models.ResourceFile;
import com.azure.resourcemanager.batch.models.RollingUpgradePolicy;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.SecurityProfile;
import com.azure.resourcemanager.batch.models.SecurityTypes;
import com.azure.resourcemanager.batch.models.StartTask;
import com.azure.resourcemanager.batch.models.StorageAccountType;
import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy;
import com.azure.resourcemanager.batch.models.UefiSettings;
import com.azure.resourcemanager.batch.models.UpgradeMode;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.UserAccount;
import com.azure.resourcemanager.batch.models.UserAssignedIdentities;
import com.azure.resourcemanager.batch.models.UserIdentity;
import com.azure.resourcemanager.batch.models.VMExtension;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.batch.models.WindowsConfiguration;
import java.io.IOException;
import java.time.Duration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Pool Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
*/
/**
* Sample code: CreatePool - SecurityProfile.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolSecurityProfile(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer")
.withSku("18_04-lts-gen2").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")
.withSecurityProfile(new SecurityProfile().withSecurityType(SecurityTypes.TRUSTED_LAUNCH)
.withEncryptionAtHost(true).withUefiSettings(new UefiSettings().withVTpmEnabled(false)))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration OSDisk.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolVirtualMachineConfigurationOSDisk(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d2s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("microsoftwindowsserver")
.withOffer("windowsserver").withSku("2022-datacenter-smalldisk"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withOsDisk(new OSDisk().withCaching(CachingType.READ_WRITE)
.withManagedDisk(new ManagedDisk().withStorageAccountType(StorageAccountType.STANDARD_SSD_LRS))
.withDiskSizeGB(100).withWriteAcceleratorEnabled(false))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalCloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration()
.withCloudServiceConfiguration(new CloudServiceConfiguration().withOsFamily("5")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(3)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalVirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_Extensions.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration Extensions.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolVirtualMachineConfigurationExtensions(
com.azure.resourcemanager.batch.BatchManager manager) throws IOException {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("0001-com-ubuntu-server-focal").withSku("20_04-lts"))
.withNodeAgentSkuId("batch.node.ubuntu 20.04")
.withExtensions(Arrays.asList(new VMExtension().withName("batchextension1")
.withPublisher("Microsoft.Azure.KeyVault").withType("KeyVaultForLinux")
.withTypeHandlerVersion("2.0").withAutoUpgradeMinorVersion(true)
.withEnableAutomaticUpgrade(true)
.withSettings(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"authenticationSettingsKey\":\"authenticationSettingsValue\",\"secretsManagementSettingsKey\":\"secretsManagementSettingsValue\"}",
Object.class, SerializerEncoding.JSON))))))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.withTargetNodeCommunicationMode(NodeCommunicationMode.DEFAULT).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities
* .json
*/
/**
* Sample code: CreatePool - UserAssignedIdentities.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUserAssignedIdentities(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withIdentity(new BatchPoolIdentity().withType(PoolIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1",
new UserAssignedIdentities(),
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2",
new UserAssignedIdentities())))
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
*/
/**
* Sample code: CreatePool - UpgradePolicy.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUpgradePolicy(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2019-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(2).withTargetLowPriorityNodes(0)))
.withUpgradePolicy(
new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)
.withAutomaticOSUpgradePolicy(new AutomaticOSUpgradePolicy().withDisableAutomaticRollback(true)
.withEnableAutomaticOSUpgrade(true).withUseRollingUpgradePolicy(true)
.withOsRollingUpgradeDeferral(true))
.withRollingUpgradePolicy(new RollingUpgradePolicy().withEnableCrossZoneUpgrade(true)
.withMaxBatchInstancePercent(20).withMaxUnhealthyInstancePercent(20)
.withMaxUnhealthyUpgradedInstancePercent(20).withPauseTimeBetweenBatches("PT0S")
.withPrioritizeUnhealthyInstances(false).withRollbackFailedInstancesOnPolicyBreach(false)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.
* json
*/
/**
* Sample code: CreatePool - accelerated networking.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolAcceleratedNetworking(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D1_V2")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withEnableAcceleratedNetworking(true))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Full VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-Datacenter-SmallDisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withDataDisks(Arrays.asList(
new DataDisk().withLun(0).withCaching(CachingType.READ_WRITE).withDiskSizeGB(30)
.withStorageAccountType(StorageAccountType.PREMIUM_LRS),
new DataDisk().withLun(1).withCaching(CachingType.NONE).withDiskSizeGB(200)
.withStorageAccountType(StorageAccountType.STANDARD_LRS)))
.withLicenseType("Windows_Server")
.withDiskEncryptionConfiguration(new DiskEncryptionConfiguration().withTargets(
Arrays.asList(DiskEncryptionTarget.OS_DISK, DiskEncryptionTarget.TEMPORARY_DISK)))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))
.withOsDisk(new OSDisk().withEphemeralOSDiskSettings(
new DiffDiskSettings().withPlacement(DiffDiskPlacement.CACHE_DISK)))))
.withScaleSettings(
new ScaleSettings()
.withAutoScale(
new AutoScaleSettings().withFormula(
"$TargetDedicatedNodes=1").withEvaluationInterval(
Duration.parse("PT5M"))))
.withNetworkConfiguration(
new NetworkConfiguration()
.withEndpointConfiguration(new PoolEndpointConfiguration().withInboundNatPools(
Arrays.asList(new InboundNatPool().withName("testnat").withProtocol(InboundEndpointProtocol.TCP)
.withBackendPort(12001).withFrontendPortRangeStart(15000).withFrontendPortRangeEnd(15100)
.withNetworkSecurityGroupRules(Arrays.asList(new NetworkSecurityGroupRule()
.withPriority(150).withAccess(NetworkSecurityGroupRuleAccess.ALLOW)
.withSourceAddressPrefix("192.100.12.45").withSourcePortRanges(Arrays.asList("1", "2")),
new NetworkSecurityGroupRule().withPriority(3500)
.withAccess(NetworkSecurityGroupRuleAccess.DENY).withSourceAddressPrefix("*")
.withSourcePortRanges(Arrays.asList("*"))))))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.
* json
*/
/**
* Sample code: CreatePool - Custom Image.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolCustomImage(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_CloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Full CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withDisplayName("my-pool-name").withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withCloudServiceConfiguration(
new CloudServiceConfiguration().withOsFamily("4").withOsVersion("WA-GUEST-OS-4.45_201708-01")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings()
.withResizeTimeout(Duration.parse("PT8M")).withTargetDedicatedNodes(6).withTargetLowPriorityNodes(28)
.withNodeDeallocationOption(ComputeNodeDeallocationOption.TASK_COMPLETION)))
.withInterNodeCommunication(InterNodeCommunicationState.ENABLED)
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"))))
.withTaskSlotsPerNode(13)
.withTaskSchedulingPolicy(new TaskSchedulingPolicy().withNodeFillType(ComputeNodeFillType.PACK))
.withUserAccounts(Arrays.asList(new UserAccount().withName("username1").withPassword("fakeTokenPlaceholder")
.withElevationLevel(ElevationLevel.ADMIN)
.withLinuxUserConfiguration(new LinuxUserConfiguration().withUid(1234).withGid(4567)
.withSshPrivateKey("fakeTokenPlaceholder"))))
.withMetadata(Arrays.asList(new MetadataItem().withName("metadata-1").withValue("value-1"),
new MetadataItem().withName("metadata-2").withValue("value-2")))
.withStartTask(new StartTask().withCommandLine("cmd /c SET")
.withResourceFiles(Arrays.asList(
new ResourceFile().withHttpUrl("https://testaccount.blob.core.windows.net/example-blob-file")
.withFilePath("c:\\temp\\gohere").withFileMode("777")))
.withEnvironmentSettings(Arrays.asList(new EnvironmentSetting().withName("MYSET").withValue("1234")))
.withUserIdentity(new UserIdentity().withAutoUser(
new AutoUserSpecification().withScope(AutoUserScope.POOL).withElevationLevel(ElevationLevel.ADMIN)))
.withMaxTaskRetryCount(6).withWaitForSuccess(true))
.withCertificates(Arrays.asList(new CertificateReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567")
.withStoreLocation(CertificateStoreLocation.LOCAL_MACHINE).withStoreName("MY")
.withVisibility(Arrays.asList(CertificateVisibility.REMOTE_USER))))
.withApplicationPackages(Arrays.asList(new ApplicationPackageReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234")
.withVersion("asdf")))
.withApplicationLicenses(Arrays.asList("app-license0", "app-license1")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.
* json
*/
/**
* Sample code: CreatePool - No public IP.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolNoPublicIP(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(
new PublicIpAddressConfiguration().withProvision(IpAddressProvisioningType.NO_PUBLIC_IPADDRESSES)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
*/
/**
* Sample code: CreatePool - ResourceTags.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolResourceTags(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer")
.withSku("18_04-lts-gen2").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withResourceTags(mapOf("TagName1", "TagValue1", "TagName2", "TagValue2")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
*/
/**
* Sample code: CreatePool - Public IPs.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolPublicIPs(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"))))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB554F8E08BCF4"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB554F8E08BCF4\"",
"properties": {
"lastModified": "2023-06-14T07:03:58.3231917Z",
"creationTime": "2023-06-14T07:03:58.3231917Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
"securityProfile": {
"securityType": "trustedLaunch",
"encryptionAtHost": true,
"uefiSettings": {
"vTpmEnabled": false
}
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-06-14T07:03:58.3231917Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - UpgradePolicy
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodePlacementConfiguration": {
"policy": "Zonal"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0
}
},
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"disableAutomaticRollback": true,
"enableAutomaticOSUpgrade": true,
"useRollingUpgradePolicy": true,
"osRollingUpgradeDeferral": true
},
"rollingUpgradePolicy": {
"enableCrossZoneUpgrade": true,
"maxBatchInstancePercent": 20,
"maxUnhealthyInstancePercent": 20,
"maxUnhealthyUpgradedInstancePercent": 20,
"pauseTimeBetweenBatches": "PT0S",
"prioritizeUnhealthyInstances": false,
"rollbackFailedInstancesOnPolicyBreach": false
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_upgrade_policy.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.windows amd64",
"nodePlacementConfiguration": {"policy": "Zonal"},
"windowsConfiguration": {"enableAutomaticUpdates": False},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 2, "targetLowPriorityNodes": 0}},
"upgradePolicy": {
"automaticOSUpgradePolicy": {
"disableAutomaticRollback": True,
"enableAutomaticOSUpgrade": True,
"osRollingUpgradeDeferral": True,
"useRollingUpgradePolicy": True,
},
"mode": "automatic",
"rollingUpgradePolicy": {
"enableCrossZoneUpgrade": True,
"maxBatchInstancePercent": 20,
"maxUnhealthyInstancePercent": 20,
"maxUnhealthyUpgradedInstancePercent": 20,
"pauseTimeBetweenBatches": "PT0S",
"prioritizeUnhealthyInstances": False,
"rollbackFailedInstancesOnPolicyBreach": False,
},
},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
func ExamplePoolClient_Create_createPoolUpgradePolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2019-datacenter-smalldisk"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
},
WindowsConfiguration: &armbatch.WindowsConfiguration{
EnableAutomaticUpdates: to.Ptr(false),
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](2),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
UpgradePolicy: &armbatch.UpgradePolicy{
AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
DisableAutomaticRollback: to.Ptr(true),
EnableAutomaticOSUpgrade: to.Ptr(true),
OSRollingUpgradeDeferral: to.Ptr(true),
UseRollingUpgradePolicy: to.Ptr(true),
},
Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
RollingUpgradePolicy: &armbatch.RollingUpgradePolicy{
EnableCrossZoneUpgrade: to.Ptr(true),
MaxBatchInstancePercent: to.Ptr[int32](20),
MaxUnhealthyInstancePercent: to.Ptr[int32](20),
MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](20),
PauseTimeBetweenBatches: to.Ptr("PT0S"),
PrioritizeUnhealthyInstances: to.Ptr(false),
RollbackFailedInstancesOnPolicyBreach: to.Ptr(false),
},
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB51E64D3C3B69\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2019-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
// Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
// },
// WindowsConfiguration: &armbatch.WindowsConfiguration{
// EnableAutomaticUpdates: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](2),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](2),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// UpgradePolicy: &armbatch.UpgradePolicy{
// AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
// DisableAutomaticRollback: to.Ptr(true),
// EnableAutomaticOSUpgrade: to.Ptr(true),
// OSRollingUpgradeDeferral: to.Ptr(true),
// UseRollingUpgradePolicy: to.Ptr(true),
// },
// Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
// RollingUpgradePolicy: &armbatch.RollingUpgradePolicy{
// EnableCrossZoneUpgrade: to.Ptr(true),
// MaxBatchInstancePercent: to.Ptr[int32](20),
// MaxUnhealthyInstancePercent: to.Ptr[int32](20),
// MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](20),
// PauseTimeBetweenBatches: to.Ptr("PT0S"),
// PrioritizeUnhealthyInstances: to.Ptr(false),
// RollbackFailedInstancesOnPolicyBreach: to.Ptr(false),
// },
// },
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
*/
async function createPoolUpgradePolicy() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2019-datacenter-smalldisk",
version: "latest",
},
nodeAgentSkuId: "batch.node.windows amd64",
nodePlacementConfiguration: { policy: "Zonal" },
windowsConfiguration: { enableAutomaticUpdates: false },
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 2, targetLowPriorityNodes: 0 },
},
upgradePolicy: {
automaticOSUpgradePolicy: {
disableAutomaticRollback: true,
enableAutomaticOSUpgrade: true,
osRollingUpgradeDeferral: true,
useRollingUpgradePolicy: true,
},
mode: "automatic",
rollingUpgradePolicy: {
enableCrossZoneUpgrade: true,
maxBatchInstancePercent: 20,
maxUnhealthyInstancePercent: 20,
maxUnhealthyUpgradedInstancePercent: 20,
pauseTimeBetweenBatches: "PT0S",
prioritizeUnhealthyInstances: false,
rollbackFailedInstancesOnPolicyBreach: false,
},
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB51E64D3C3B69"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB51E64D3C3B69\"",
"properties": {
"lastModified": "2023-05-11T06:16:44.2372184Z",
"creationTime": "2023-05-11T06:16:44.2372184Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-05-11T06:16:44.2372184Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-05-11T06:16:44.2372184Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"nodePlacementConfiguration": {
"policy": "Zonal"
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 2,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-05-11T06:16:44.2372184Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"disableAutomaticRollback": true,
"enableAutomaticOSUpgrade": true,
"useRollingUpgradePolicy": true,
"osRollingUpgradeDeferral": true
},
"rollingUpgradePolicy": {
"enableCrossZoneUpgrade": true,
"maxBatchInstancePercent": 20,
"maxUnhealthyInstancePercent": 20,
"maxUnhealthyUpgradedInstancePercent": 20,
"pauseTimeBetweenBatches": "PT0S",
"prioritizeUnhealthyInstances": false,
"rollbackFailedInstancesOnPolicyBreach": false
}
}
}
}
CreatePool - UserAssignedIdentities
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
}
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_user_assigned_identities.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {},
},
},
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18.04-LTS",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"vmSize": "STANDARD_D4",
},
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
func ExamplePoolClient_Create_createPoolUserAssignedIdentities() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Identity: &armbatch.PoolIdentity{
Type: to.Ptr(armbatch.PoolIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armbatch.UserAssignedIdentities{
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {},
},
},
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18.04-LTS"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Identity: &armbatch.PoolIdentity{
// Type: to.Ptr(armbatch.PoolIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armbatch.UserAssignedIdentities{
// "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armbatch.UserAssignedIdentities{
// ClientID: to.Ptr("clientId1"),
// PrincipalID: to.Ptr("principalId1"),
// },
// "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": &armbatch.UserAssignedIdentities{
// ClientID: to.Ptr("clientId2"),
// PrincipalID: to.Ptr("principalId2"),
// },
// },
// },
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18.04-LTS"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
*/
async function createPoolUserAssignedIdentities() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18.04-LTS",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1":
{},
"/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2":
{},
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
Identity = new ManagedServiceIdentity("UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(),
[new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity(),
},
},
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "18.04-LTS",
Version = "latest",
}, "batch.node.ubuntu 18.04"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2020-10-01T10:22:55.9407275Z",
"creationTime": "2020-10-01T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2020-10-01T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2020-10-01T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {
"principalId": "principalId1",
"clientId": "clientId1"
},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {
"principalId": "principalId2",
"clientId": "clientId2"
}
}
}
}
CreatePool - VirtualMachineConfiguration Extensions
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-focal",
"sku": "20_04-lts"
},
"nodeAgentSkuId": "batch.node.ubuntu 20.04",
"extensions": [
{
"name": "batchextension1",
"type": "KeyVaultForLinux",
"publisher": "Microsoft.Azure.KeyVault",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"enableAutomaticUpgrade": true,
"settings": {
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
"authenticationSettingsKey": "authenticationSettingsValue"
}
}
]
}
},
"targetNodeCommunicationMode": "Default"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration_extensions.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"extensions": [
{
"autoUpgradeMinorVersion": True,
"enableAutomaticUpgrade": True,
"name": "batchextension1",
"publisher": "Microsoft.Azure.KeyVault",
"settings": {
"authenticationSettingsKey": "authenticationSettingsValue",
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
},
"type": "KeyVaultForLinux",
"typeHandlerVersion": "2.0",
}
],
"imageReference": {
"offer": "0001-com-ubuntu-server-focal",
"publisher": "Canonical",
"sku": "20_04-lts",
},
"nodeAgentSkuId": "batch.node.ubuntu 20.04",
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"targetNodeCommunicationMode": "Default",
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
func ExamplePoolClient_Create_createPoolVirtualMachineConfigurationExtensions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("0001-com-ubuntu-server-focal"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("20_04-lts"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 20.04"),
Extensions: []*armbatch.VMExtension{
{
Name: to.Ptr("batchextension1"),
Type: to.Ptr("KeyVaultForLinux"),
AutoUpgradeMinorVersion: to.Ptr(true),
EnableAutomaticUpgrade: to.Ptr(true),
Publisher: to.Ptr("Microsoft.Azure.KeyVault"),
Settings: map[string]any{
"authenticationSettingsKey": "authenticationSettingsValue",
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
},
TypeHandlerVersion: to.Ptr("2.0"),
}},
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
TargetNodeCommunicationMode: to.Ptr(armbatch.NodeCommunicationModeDefault),
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("0001-com-ubuntu-server-focal"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("20_04-lts"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 20.04"),
// Extensions: []*armbatch.VMExtension{
// {
// Name: to.Ptr("batchextension1"),
// Type: to.Ptr("KeyVaultForLinux"),
// AutoUpgradeMinorVersion: to.Ptr(true),
// EnableAutomaticUpgrade: to.Ptr(true),
// Publisher: to.Ptr("Microsoft.Azure.KeyVault"),
// Settings: map[string]any{
// "authenticationSettingsKey": "authenticationSettingsValue",
// "secretsManagementSettingsKey": "secretsManagementSettingsValue",
// },
// TypeHandlerVersion: to.Ptr("2.0"),
// }},
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TargetNodeCommunicationMode: to.Ptr(armbatch.NodeCommunicationModeDefault),
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
*/
async function createPoolVirtualMachineConfigurationExtensions() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "0001-com-ubuntu-server-focal",
publisher: "Canonical",
sku: "20_04-lts",
},
nodeAgentSkuId: "batch.node.ubuntu 20.04",
extensions: [
{
name: "batchextension1",
type: "KeyVaultForLinux",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
publisher: "Microsoft.Azure.KeyVault",
settings: {
authenticationSettingsKey: "authenticationSettingsValue",
secretsManagementSettingsKey: "secretsManagementSettingsValue",
},
typeHandlerVersion: "2.0",
},
],
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
targetNodeCommunicationMode: "Default",
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-focal",
Sku = "20_04-lts",
}, "batch.node.ubuntu 20.04")
{
Extensions =
{
new BatchVmExtension("batchextension1","Microsoft.Azure.KeyVault","KeyVaultForLinux")
{
TypeHandlerVersion = "2.0",
AutoUpgradeMinorVersion = true,
EnableAutomaticUpgrade = true,
Settings = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["authenticationSettingsKey"] = "authenticationSettingsValue",
["secretsManagementSettingsKey"] = "secretsManagementSettingsValue"}),
}
},
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
TargetNodeCommunicationMode = NodeCommunicationMode.Default,
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-focal",
"sku": "20_04-lts"
},
"nodeAgentSkuId": "batch.node.ubuntu 20.04",
"extensions": [
{
"name": "batchextension1",
"type": "KeyVaultForLinux",
"publisher": "Microsoft.Azure.KeyVault",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"enableAutomaticUpgrade": true,
"settings": {
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
"authenticationSettingsKey": "authenticationSettingsValue"
}
}
]
}
},
"targetNodeCommunicationMode": "Default"
}
}
CreatePool - VirtualMachineConfiguration OSDisk
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d2s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "microsoftwindowsserver",
"offer": "windowsserver",
"sku": "2022-datacenter-smalldisk"
},
"osDisk": {
"diskSizeGB": 100,
"managedDisk": {
"storageAccountType": "StandardSSD_LRS"
},
"caching": "ReadWrite",
"writeAcceleratorEnabled": false
},
"nodeAgentSkuId": "batch.node.windows amd64"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration_managed_os_disk.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "windowsserver",
"publisher": "microsoftwindowsserver",
"sku": "2022-datacenter-smalldisk",
},
"nodeAgentSkuId": "batch.node.windows amd64",
"osDisk": {
"caching": "ReadWrite",
"diskSizeGB": 100,
"managedDisk": {"storageAccountType": "StandardSSD_LRS"},
"writeAcceleratorEnabled": False,
},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d2s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
func ExamplePoolClient_Create_createPoolVirtualMachineConfigurationOsDisk() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("windowsserver"),
Publisher: to.Ptr("microsoftwindowsserver"),
SKU: to.Ptr("2022-datacenter-smalldisk"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
OSDisk: &armbatch.OSDisk{
Caching: to.Ptr(armbatch.CachingTypeReadWrite),
DiskSizeGB: to.Ptr[int32](100),
ManagedDisk: &armbatch.ManagedDisk{
StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardSSDLRS),
},
WriteAcceleratorEnabled: to.Ptr(false),
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("Standard_d2s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB51F396992B8D\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("windowsserver"),
// Publisher: to.Ptr("microsoftwindowsserver"),
// SKU: to.Ptr("2022-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// OSDisk: &armbatch.OSDisk{
// Caching: to.Ptr(armbatch.CachingTypeReadWrite),
// DiskSizeGB: to.Ptr[int32](100),
// ManagedDisk: &armbatch.ManagedDisk{
// StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardSSDLRS),
// },
// WriteAcceleratorEnabled: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D2_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
*/
async function createPoolVirtualMachineConfigurationOSDisk() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "windowsserver",
publisher: "microsoftwindowsserver",
sku: "2022-datacenter-smalldisk",
},
nodeAgentSkuId: "batch.node.windows amd64",
osDisk: {
caching: "ReadWrite",
diskSizeGB: 100,
managedDisk: { storageAccountType: "StandardSSD_LRS" },
writeAcceleratorEnabled: false,
},
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "Standard_d2s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB51F14DC1A8AD"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB51F396992B8D\"",
"properties": {
"lastModified": "2023-08-24T02:12:27.7527697Z",
"creationTime": "2023-08-24T02:12:27.7527697Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-08-24T02:12:27.7527697Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-08-24T02:12:27.7527697Z",
"vmSize": "STANDARD_D2_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "microsoftwindowsserver",
"offer": "windowsserver",
"sku": "2022-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"osDisk": {
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "StandardSSD_LRS"
},
"diskSizeGB": 100,
"writeAcceleratorEnabled": false
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-08-24T02:12:27.7527697Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - VirtualMachineConfiguration ServiceArtifactReference
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"serviceArtifactReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0
}
},
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"enableAutomaticOSUpgrade": true
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration_service_artifact_reference.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.windows amd64",
"serviceArtifactReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"
},
"windowsConfiguration": {"enableAutomaticUpdates": False},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 2, "targetLowPriorityNodes": 0}},
"upgradePolicy": {"automaticOSUpgradePolicy": {"enableAutomaticOSUpgrade": True}, "mode": "automatic"},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
func ExamplePoolClient_Create_createPoolVirtualMachineConfigurationServiceArtifactReference() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2019-datacenter-smalldisk"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
ServiceArtifactReference: &armbatch.ServiceArtifactReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"),
},
WindowsConfiguration: &armbatch.WindowsConfiguration{
EnableAutomaticUpdates: to.Ptr(false),
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](2),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
UpgradePolicy: &armbatch.UpgradePolicy{
AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
EnableAutomaticOSUpgrade: to.Ptr(true),
},
Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("mypool41"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB51F396992B8D\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2019-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// ServiceArtifactReference: &armbatch.ServiceArtifactReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"),
// },
// WindowsConfiguration: &armbatch.WindowsConfiguration{
// EnableAutomaticUpdates: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](2),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](2),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// UpgradePolicy: &armbatch.UpgradePolicy{
// AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
// EnableAutomaticOSUpgrade: to.Ptr(true),
// },
// Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
// },
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
*/
async function createPoolVirtualMachineConfigurationServiceArtifactReference() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2019-datacenter-smalldisk",
version: "latest",
},
nodeAgentSkuId: "batch.node.windows amd64",
serviceArtifactReference: {
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile",
},
windowsConfiguration: { enableAutomaticUpdates: false },
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 2, targetLowPriorityNodes: 0 },
},
upgradePolicy: {
automaticOSUpgradePolicy: { enableAutomaticOSUpgrade: true },
mode: "automatic",
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.batch.models.ApplicationPackageReference;
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.AutoUserScope;
import com.azure.resourcemanager.batch.models.AutoUserSpecification;
import com.azure.resourcemanager.batch.models.AutomaticOSUpgradePolicy;
import com.azure.resourcemanager.batch.models.BatchPoolIdentity;
import com.azure.resourcemanager.batch.models.CachingType;
import com.azure.resourcemanager.batch.models.CertificateReference;
import com.azure.resourcemanager.batch.models.CertificateStoreLocation;
import com.azure.resourcemanager.batch.models.CertificateVisibility;
import com.azure.resourcemanager.batch.models.CloudServiceConfiguration;
import com.azure.resourcemanager.batch.models.ComputeNodeDeallocationOption;
import com.azure.resourcemanager.batch.models.ComputeNodeFillType;
import com.azure.resourcemanager.batch.models.DataDisk;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.DiffDiskPlacement;
import com.azure.resourcemanager.batch.models.DiffDiskSettings;
import com.azure.resourcemanager.batch.models.DiskEncryptionConfiguration;
import com.azure.resourcemanager.batch.models.DiskEncryptionTarget;
import com.azure.resourcemanager.batch.models.ElevationLevel;
import com.azure.resourcemanager.batch.models.EnvironmentSetting;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.InboundEndpointProtocol;
import com.azure.resourcemanager.batch.models.InboundNatPool;
import com.azure.resourcemanager.batch.models.InterNodeCommunicationState;
import com.azure.resourcemanager.batch.models.IpAddressProvisioningType;
import com.azure.resourcemanager.batch.models.LinuxUserConfiguration;
import com.azure.resourcemanager.batch.models.ManagedDisk;
import com.azure.resourcemanager.batch.models.MetadataItem;
import com.azure.resourcemanager.batch.models.NetworkConfiguration;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRule;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRuleAccess;
import com.azure.resourcemanager.batch.models.NodeCommunicationMode;
import com.azure.resourcemanager.batch.models.NodePlacementConfiguration;
import com.azure.resourcemanager.batch.models.NodePlacementPolicyType;
import com.azure.resourcemanager.batch.models.OSDisk;
import com.azure.resourcemanager.batch.models.PoolEndpointConfiguration;
import com.azure.resourcemanager.batch.models.PoolIdentityType;
import com.azure.resourcemanager.batch.models.PublicIpAddressConfiguration;
import com.azure.resourcemanager.batch.models.ResourceFile;
import com.azure.resourcemanager.batch.models.RollingUpgradePolicy;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.ServiceArtifactReference;
import com.azure.resourcemanager.batch.models.StartTask;
import com.azure.resourcemanager.batch.models.StorageAccountType;
import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy;
import com.azure.resourcemanager.batch.models.UpgradeMode;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.UserAccount;
import com.azure.resourcemanager.batch.models.UserAssignedIdentities;
import com.azure.resourcemanager.batch.models.UserIdentity;
import com.azure.resourcemanager.batch.models.VMExtension;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.batch.models.WindowsConfiguration;
import java.io.IOException;
import java.time.Duration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Pool Create.
*/
public final class Main {
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration ServiceArtifactReference.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolVirtualMachineConfigurationServiceArtifactReference(
com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2019-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withServiceArtifactReference(new ServiceArtifactReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(2).withTargetLowPriorityNodes(0)))
.withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)
.withAutomaticOSUpgradePolicy(new AutomaticOSUpgradePolicy().withEnableAutomaticOSUpgrade(true)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration OSDisk.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolVirtualMachineConfigurationOSDisk(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d2s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("microsoftwindowsserver")
.withOffer("windowsserver").withSku("2022-datacenter-smalldisk"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withOsDisk(new OSDisk().withCaching(CachingType.READ_WRITE)
.withManagedDisk(new ManagedDisk().withStorageAccountType(StorageAccountType.STANDARD_SSD_LRS))
.withDiskSizeGB(100).withWriteAcceleratorEnabled(false))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalCloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration()
.withCloudServiceConfiguration(new CloudServiceConfiguration().withOsFamily("5")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(3)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalVirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_Extensions.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration Extensions.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolVirtualMachineConfigurationExtensions(
com.azure.resourcemanager.batch.BatchManager manager) throws IOException {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("0001-com-ubuntu-server-focal").withSku("20_04-lts"))
.withNodeAgentSkuId("batch.node.ubuntu 20.04")
.withExtensions(Arrays.asList(new VMExtension().withName("batchextension1")
.withPublisher("Microsoft.Azure.KeyVault").withType("KeyVaultForLinux")
.withTypeHandlerVersion("2.0").withAutoUpgradeMinorVersion(true)
.withEnableAutomaticUpgrade(true)
.withSettings(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"authenticationSettingsKey\":\"authenticationSettingsValue\",\"secretsManagementSettingsKey\":\"secretsManagementSettingsValue\"}",
Object.class, SerializerEncoding.JSON))))))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.withTargetNodeCommunicationMode(NodeCommunicationMode.DEFAULT).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities
* .json
*/
/**
* Sample code: CreatePool - UserAssignedIdentities.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUserAssignedIdentities(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withIdentity(new BatchPoolIdentity().withType(PoolIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1",
new UserAssignedIdentities(),
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2",
new UserAssignedIdentities())))
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
*/
/**
* Sample code: CreatePool - UpgradePolicy.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUpgradePolicy(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2019-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(2).withTargetLowPriorityNodes(0)))
.withUpgradePolicy(
new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)
.withAutomaticOSUpgradePolicy(new AutomaticOSUpgradePolicy().withDisableAutomaticRollback(true)
.withEnableAutomaticOSUpgrade(true).withUseRollingUpgradePolicy(true)
.withOsRollingUpgradeDeferral(true))
.withRollingUpgradePolicy(new RollingUpgradePolicy().withEnableCrossZoneUpgrade(true)
.withMaxBatchInstancePercent(20).withMaxUnhealthyInstancePercent(20)
.withMaxUnhealthyUpgradedInstancePercent(20).withPauseTimeBetweenBatches("PT0S")
.withPrioritizeUnhealthyInstances(false).withRollbackFailedInstancesOnPolicyBreach(false)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.
* json
*/
/**
* Sample code: CreatePool - accelerated networking.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolAcceleratedNetworking(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D1_V2")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withEnableAcceleratedNetworking(true))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Full VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-Datacenter-SmallDisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withDataDisks(Arrays.asList(
new DataDisk().withLun(0).withCaching(CachingType.READ_WRITE).withDiskSizeGB(30)
.withStorageAccountType(StorageAccountType.PREMIUM_LRS),
new DataDisk().withLun(1).withCaching(CachingType.NONE).withDiskSizeGB(200)
.withStorageAccountType(StorageAccountType.STANDARD_LRS)))
.withLicenseType("Windows_Server")
.withDiskEncryptionConfiguration(new DiskEncryptionConfiguration().withTargets(
Arrays.asList(DiskEncryptionTarget.OS_DISK, DiskEncryptionTarget.TEMPORARY_DISK)))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))
.withOsDisk(new OSDisk().withEphemeralOSDiskSettings(
new DiffDiskSettings().withPlacement(DiffDiskPlacement.CACHE_DISK)))))
.withScaleSettings(
new ScaleSettings()
.withAutoScale(
new AutoScaleSettings().withFormula(
"$TargetDedicatedNodes=1").withEvaluationInterval(
Duration.parse("PT5M"))))
.withNetworkConfiguration(
new NetworkConfiguration()
.withEndpointConfiguration(new PoolEndpointConfiguration().withInboundNatPools(
Arrays.asList(new InboundNatPool().withName("testnat").withProtocol(InboundEndpointProtocol.TCP)
.withBackendPort(12001).withFrontendPortRangeStart(15000).withFrontendPortRangeEnd(15100)
.withNetworkSecurityGroupRules(Arrays.asList(new NetworkSecurityGroupRule()
.withPriority(150).withAccess(NetworkSecurityGroupRuleAccess.ALLOW)
.withSourceAddressPrefix("192.100.12.45").withSourcePortRanges(Arrays.asList("1", "2")),
new NetworkSecurityGroupRule().withPriority(3500)
.withAccess(NetworkSecurityGroupRuleAccess.DENY).withSourceAddressPrefix("*")
.withSourcePortRanges(Arrays.asList("*"))))))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.
* json
*/
/**
* Sample code: CreatePool - Custom Image.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolCustomImage(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_CloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Full CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withDisplayName("my-pool-name").withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withCloudServiceConfiguration(
new CloudServiceConfiguration().withOsFamily("4").withOsVersion("WA-GUEST-OS-4.45_201708-01")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings()
.withResizeTimeout(Duration.parse("PT8M")).withTargetDedicatedNodes(6).withTargetLowPriorityNodes(28)
.withNodeDeallocationOption(ComputeNodeDeallocationOption.TASK_COMPLETION)))
.withInterNodeCommunication(InterNodeCommunicationState.ENABLED)
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"))))
.withTaskSlotsPerNode(13)
.withTaskSchedulingPolicy(new TaskSchedulingPolicy().withNodeFillType(ComputeNodeFillType.PACK))
.withUserAccounts(Arrays.asList(new UserAccount().withName("username1").withPassword("fakeTokenPlaceholder")
.withElevationLevel(ElevationLevel.ADMIN)
.withLinuxUserConfiguration(new LinuxUserConfiguration().withUid(1234).withGid(4567)
.withSshPrivateKey("fakeTokenPlaceholder"))))
.withMetadata(Arrays.asList(new MetadataItem().withName("metadata-1").withValue("value-1"),
new MetadataItem().withName("metadata-2").withValue("value-2")))
.withStartTask(new StartTask().withCommandLine("cmd /c SET")
.withResourceFiles(Arrays.asList(
new ResourceFile().withHttpUrl("https://testaccount.blob.core.windows.net/example-blob-file")
.withFilePath("c:\\temp\\gohere").withFileMode("777")))
.withEnvironmentSettings(Arrays.asList(new EnvironmentSetting().withName("MYSET").withValue("1234")))
.withUserIdentity(new UserIdentity().withAutoUser(
new AutoUserSpecification().withScope(AutoUserScope.POOL).withElevationLevel(ElevationLevel.ADMIN)))
.withMaxTaskRetryCount(6).withWaitForSuccess(true))
.withCertificates(Arrays.asList(new CertificateReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567")
.withStoreLocation(CertificateStoreLocation.LOCAL_MACHINE).withStoreName("MY")
.withVisibility(Arrays.asList(CertificateVisibility.REMOTE_USER))))
.withApplicationPackages(Arrays.asList(new ApplicationPackageReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234")
.withVersion("asdf")))
.withApplicationLicenses(Arrays.asList("app-license0", "app-license1")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.
* json
*/
/**
* Sample code: CreatePool - No public IP.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolNoPublicIP(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(
new PublicIpAddressConfiguration().withProvision(IpAddressProvisioningType.NO_PUBLIC_IPADDRESSES)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
*/
/**
* Sample code: CreatePool - ResourceTags.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolResourceTags(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer")
.withSku("18_04-lts-gen2").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withResourceTags(mapOf("TagName1", "TagValue1", "TagName2", "TagValue2")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
*/
/**
* Sample code: CreatePool - Public IPs.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolPublicIPs(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"))))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB51F14DC1A8AD"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "mypool41",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB51F396992B8D\"",
"properties": {
"lastModified": "2023-05-11T07:44:44.8580493Z",
"creationTime": "2023-05-11T07:44:44.8580493Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-05-11T07:44:44.8580493Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-05-11T07:44:44.8580493Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"serviceArtifactReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 2,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-05-11T07:44:44.8580493Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"enableAutomaticOSUpgrade": true
}
}
}
}
Definitioner
Name |
Description |
AllocationState
|
Om poolen ändrar storlek.
|
ApplicationPackageReference
|
Länka till ett programpaket i batchkontot
|
AutomaticOSUpgradePolicy
|
De konfigurationsparametrar som används för att utföra automatisk operativsystemuppgradering.
|
AutoScaleRun
|
Resultatet och felen från en körning av en pool autoskalningsformel.
|
AutoScaleRunError
|
Ett fel som uppstod vid automatisk skalning av en pool.
|
AutoScaleSettings
|
Autoskalningsinställningar för poolen.
|
AutoUserScope
|
Omfånget för den automatiska användaren
|
AutoUserSpecification
|
Anger parametrarna för den automatiska användare som kör en uppgift i Batch-tjänsten.
|
AzureBlobFileSystemConfiguration
|
Information som används för att ansluta till en Azure Storage-container med blobfuse.
|
AzureFileShareConfiguration
|
Information som används för att ansluta till en Azure Fileshare.
|
BatchPoolIdentity
|
Identiteten för Batch-poolen, om den är konfigurerad. Om poolidentiteten uppdateras under uppdateringen av en befintlig pool kommer endast de nya virtuella datorer som skapas efter att poolen krymper till 0 att ha de uppdaterade identiteterna
|
CachingType
|
Typen av cachelagring som ska aktiveras för disken.
|
CertificateReference
|
En referens till ett certifikat som ska installeras på beräkningsnoder i en pool. Detta måste finnas i samma konto som poolen.
|
CertificateStoreLocation
|
Platsen för certifikatarkivet på beräkningsnoden där certifikatet ska installeras.
|
CertificateVisibility
|
Vilka användarkonton på beräkningsnoden ska ha åtkomst till certifikatets privata data.
|
CIFSMountConfiguration
|
Information som används för att ansluta till ett CIFS-filsystem.
|
CloudError
|
Ett felsvar från Batch-tjänsten.
|
CloudErrorBody
|
Ett felsvar från Batch-tjänsten.
|
CloudServiceConfiguration
|
Konfigurationen för noder i en pool baserat på Azure Cloud Services-plattformen.
|
ComputeNodeDeallocationOption
|
Avgör vad du ska göra med en nod och dess aktiviteter som körs när den har valts för frigöring.
|
ComputeNodeFillType
|
Hur aktiviteter ska distribueras mellan beräkningsnoder.
|
ComputeNodeIdentityReference
|
Referensen till en användartilldelad identitet som är associerad med batchpoolen som en beräkningsnod ska använda.
|
ContainerConfiguration
|
Konfigurationen för containeraktiverade pooler.
|
ContainerRegistry
|
Ett privat containerregister.
|
ContainerType
|
Containertekniken som ska användas.
|
ContainerWorkingDirectory
|
En flagga som anger var containeruppgiftens arbetskatalog finns. Standardvärdet är "taskWorkingDirectory".
|
DataDisk
|
Inställningar som ska användas av de datadiskar som är associerade med beräkningsnoder i poolen. När du använder anslutna datadiskar måste du montera och formatera diskarna inifrån en virtuell dator för att kunna använda dem.
|
DeploymentConfiguration
|
Egenskaper för distributionskonfiguration.
|
DiffDiskPlacement
|
Anger den tillfälliga diskplaceringen för operativsystemdisken för alla virtuella datorer i poolen.
|
DiffDiskSettings
|
Anger tillfälliga diskinställningar för den operativsystemdisk som används av den virtuella datorn.
|
DiskEncryptionConfiguration
|
Diskkrypteringskonfigurationen som tillämpas på beräkningsnoder i poolen. Diskkrypteringskonfiguration stöds inte i En Linux-pool som skapats med Virtual Machine Image eller Azure Compute Gallery Image.
|
DiskEncryptionTarget
|
Listan över diskmål Batch Service krypterar på beräkningsnoden
|
DynamicVNetAssignmentScope
|
Omfånget för dynamisk vnet-tilldelning.
|
ElevationLevel
|
Användarens höjdnivå.
|
EnvironmentSetting
|
En miljövariabel som ska anges i en uppgiftsprocess.
|
FixedScaleSettings
|
Fasta skalningsinställningar för poolen.
|
ImageReference
|
En referens till en Azure Virtual Machines Marketplace-avbildning eller Azure Image-resursen för en anpassad virtuell dator. Information om hur du hämtar listan över alla imageReferences som verifierats av Azure Batch finns i åtgärden "List supported node agent SKU:er".
|
InboundEndpointProtocol
|
Protokollet för slutpunkten.
|
InboundNatPool
|
En inkommande NAT-pool som kan användas för att adressera specifika portar på beräkningsnoder i en Batch-pool externt.
|
InterNodeCommunicationState
|
Om poolen tillåter direkt kommunikation mellan noder.
|
IPAddressProvisioningType
|
Etableringstypen för offentliga IP-adresser för Batch-poolen.
|
LinuxUserConfiguration
|
Egenskaper som används för att skapa ett användarkonto på en Linux-nod.
|
LoginMode
|
Inloggningsläge för användare
|
ManagedDisk
|
|
MetadataItem
|
Ett namn/värde-par som är associerat med en Batch-tjänstresurs.
|
MountConfiguration
|
Filsystemet som ska monteras på varje nod.
|
NetworkConfiguration
|
Nätverkskonfigurationen för en pool.
|
NetworkSecurityGroupRule
|
En regel för nätverkssäkerhetsgrupp som ska tillämpas på en inkommande slutpunkt.
|
NetworkSecurityGroupRuleAccess
|
Den åtgärd som ska vidtas för en angiven IP-adress, ett undernätsintervall eller en tagg.
|
NFSMountConfiguration
|
Information som används för att ansluta till ett NFS-filsystem.
|
NodeCommunicationMode
|
Avgör hur en pool kommunicerar med Batch-tjänsten.
|
NodePlacementConfiguration
|
Konfiguration av nodplacering för batchpooler.
|
NodePlacementPolicyType
|
Placeringsprincipen för allokering av noder i poolen.
|
OSDisk
|
Inställningar för den virtuella datorns operativsystemdisk.
|
Pool
|
Innehåller information om en pool.
|
PoolEndpointConfiguration
|
Slutpunktskonfigurationen för en pool.
|
PoolIdentityType
|
Den typ av identitet som används för Batch-poolen.
|
PoolProvisioningState
|
Poolens aktuella tillstånd.
|
PublicIPAddressConfiguration
|
Den offentliga IP-adresskonfigurationen för nätverkskonfigurationen för en pool.
|
ResizeError
|
Ett fel som uppstod vid storleksändring av en pool.
|
ResizeOperationStatus
|
Information om den aktuella eller senast slutförda storleksändringsåtgärden.
|
ResourceFile
|
En enda fil eller flera filer som ska laddas ned till en beräkningsnod.
|
RollingUpgradePolicy
|
De konfigurationsparametrar som används vid löpande uppgradering.
|
ScaleSettings
|
Skalningsinställningar för poolen
|
SecurityProfile
|
Anger säkerhetsprofilinställningarna för den virtuella datorn eller vm-skalningsuppsättningen.
|
SecurityTypes
|
Anger SecurityType för den virtuella datorn. Det måste anges till ett angivet värde för att aktivera UefiSettings.
|
ServiceArtifactReference
|
Anger tjänstartefaktreferens-ID:t som används för att ange samma avbildningsversion för alla virtuella datorer i skalningsuppsättningen när du använder den senaste avbildningsversionen.
|
StartTask
|
En uppgift som körs när en beräkningsnod ansluter till en pool i Azure Batch-tjänsten, eller när beräkningsnoden startas om eller omskapas.
|
StorageAccountType
|
Typ av lagringskonto för användning vid skapande av datadiskar eller OS-diskar.
|
TaskContainerSettings
|
Containerinställningarna för en uppgift.
|
TaskSchedulingPolicy
|
Anger hur aktiviteter ska distribueras mellan beräkningsnoder.
|
UefiSettings
|
Anger de säkerhetsinställningar som säker start och vTPM som används när den virtuella datorn skapas.
|
UpgradeMode
|
Anger läget för en uppgradering till virtuella datorer i skalningsuppsättningen.
Möjliga värden:
Manuell – Du styr tillämpningen av uppdateringar av virtuella datorer i skalningsuppsättningen. Du gör detta med hjälp av åtgärden manualUpgrade.
Automatisk – Alla virtuella datorer i skalningsuppsättningen uppdateras automatiskt samtidigt.
Rullande – Skalningsuppsättningen utför uppdateringar i batchar med en valfri paustid däremellan.
|
UpgradePolicy
|
Beskriver en uppgraderingsprincip – automatisk, manuell eller rullande.
|
UserAccount
|
Egenskaper som används för att skapa en användare på en Azure Batch nod.
|
UserAssignedIdentities
|
Listan över associerade användaridentiteter.
|
UserIdentity
|
Definitionen av den användaridentitet som aktiviteten körs under.
|
VirtualMachineConfiguration
|
Konfigurationen för beräkningsnoder i en pool baserat på Azure Virtual Machines-infrastrukturen.
|
VMExtension
|
Konfigurationen för tillägg för virtuella datorer.
|
WindowsConfiguration
|
Inställningar för Windows-operativsystem som ska tillämpas på den virtuella datorn.
|
WindowsUserConfiguration
|
Egenskaper som används för att skapa ett användarkonto på en Windows-nod.
|
AllocationState
Om poolen ändrar storlek.
Name |
Typ |
Description |
Resizing
|
string
|
Poolen ändrar storlek. d.v.s. att beräkningsnoder läggs till eller tas bort från poolen.
|
Steady
|
string
|
Poolen ändrar inte storlek. Det finns inga ändringar i antalet noder i poolen som pågår. En pool anger det här tillståndet när den skapas och när inga åtgärder utförs i poolen för att ändra antalet noder.
|
Stopping
|
string
|
Poolen ändrade storlek, men användaren har begärt att storleksändringen ska stoppas, men stoppbegäran har ännu inte slutförts.
|
ApplicationPackageReference
Länka till ett programpaket i batchkontot
Name |
Typ |
Description |
id
|
string
|
ID för programpaketet som ska installeras. Detta måste finnas i samma batchkonto som poolen. Detta kan antingen vara en referens till en viss version eller standardversionen om det finns en sådan.
|
version
|
string
|
Den version av programmet som ska distribueras. Om den utelämnas distribueras standardversionen.
Om detta utelämnas och ingen standardversion har angetts för det här programmet misslyckas begäran med felkoden InvalidApplicationPackageReferences. Om du anropar REST-API:et direkt är HTTP-statuskoden 409.
|
AutomaticOSUpgradePolicy
De konfigurationsparametrar som används för att utföra automatisk operativsystemuppgradering.
Name |
Typ |
Description |
disableAutomaticRollback
|
boolean
|
Om funktionen för återställning av operativsystemavbildningar ska inaktiveras.
|
enableAutomaticOSUpgrade
|
boolean
|
Anger om OS-uppgraderingar automatiskt ska tillämpas på skalningsuppsättningsinstanser i löpande format när en nyare version av OS-avbildningen blir tillgänglig.
Om detta är inställt på true för Windows-baserade pooler kan inte WindowsConfiguration.enableAutomaticUpdates anges till true.
|
osRollingUpgradeDeferral
|
boolean
|
Skjut upp OS-uppgraderingar på TV-datorerna om de kör uppgifter.
|
useRollingUpgradePolicy
|
boolean
|
Anger om principen för löpande uppgradering ska användas under automatisk uppgradering av operativsystemet. Automatisk uppgradering av operativsystem återgår till standardprincipen om ingen princip har definierats på VMSS.
|
AutoScaleRun
Resultatet och felen från en körning av en pool autoskalningsformel.
Name |
Typ |
Description |
error
|
AutoScaleRunError
|
Information om felet som påträffades vid utvärdering av autoskalningsformeln i poolen, om utvärderingen misslyckades.
|
evaluationTime
|
string
|
Tiden då autoskalningsformeln senast utvärderades.
|
results
|
string
|
De slutliga värdena för alla variabler som används i utvärderingen av autoskalningsformeln.
Varje variabelvärde returneras i formuläret $variable=värde, och variabler avgränsas med semikolon.
|
AutoScaleRunError
Ett fel som uppstod vid automatisk skalning av en pool.
Name |
Typ |
Description |
code
|
string
|
En identifierare för felet. Koder är invarianta och är avsedda att användas programmatiskt.
|
details
|
AutoScaleRunError[]
|
Ytterligare information om felet.
|
message
|
string
|
Ett meddelande som beskriver felet, avsett att vara lämpligt för visning i ett användargränssnitt.
|
AutoScaleSettings
Autoskalningsinställningar för poolen.
Name |
Typ |
Description |
evaluationInterval
|
string
|
Tidsintervallet för att automatiskt justera poolstorleken enligt autoskalningsformeln.
Om det utelämnas är standardvärdet 15 minuter (PT15M).
|
formula
|
string
|
En formel för önskat antal beräkningsnoder i poolen.
|
AutoUserScope
Omfånget för den automatiska användaren
Name |
Typ |
Description |
Pool
|
string
|
Anger att aktiviteten körs som det vanliga automatiska användarkontot som skapas på varje nod i en pool.
|
Task
|
string
|
Anger att tjänsten ska skapa en ny användare för uppgiften.
|
AutoUserSpecification
Anger parametrarna för den automatiska användare som kör en uppgift i Batch-tjänsten.
Name |
Typ |
Description |
elevationLevel
|
ElevationLevel
|
Den automatiska användarens höjdnivå.
Standardvärdet är nonAdmin.
|
scope
|
AutoUserScope
|
Omfånget för den automatiska användaren
Standardvärdet är Pool. Om poolen kör Windows ska värdet Aktivitet anges om striktare isolering mellan aktiviteter krävs. Om uppgiften till exempel muterar registret på ett sätt som kan påverka andra aktiviteter, eller om certifikat har angetts i poolen som inte ska vara tillgängliga för normala uppgifter men som bör vara tillgängliga för startaktiviteter.
|
AzureBlobFileSystemConfiguration
Information som används för att ansluta till en Azure Storage-container med blobfuse.
Name |
Typ |
Description |
accountKey
|
string
|
Azure Storage-kontonyckeln.
Den här egenskapen är ömsesidigt uteslutande med både sasKey och identitet; exakt ett måste anges.
|
accountName
|
string
|
Namnet på Azure Storage-kontot.
|
blobfuseOptions
|
string
|
Ytterligare kommandoradsalternativ för att skicka till monteringskommandot.
Det här är alternativ för "net use" i Windows och "mount"-alternativ i Linux.
|
containerName
|
string
|
Namnet på Azure Blob Storage container.
|
identityReference
|
ComputeNodeIdentityReference
|
Referensen till den användartilldelade identitet som ska användas för att komma åt containerName
Den här egenskapen är ömsesidigt uteslutande med både accountKey och sasKey; exakt ett måste anges.
|
relativeMountPath
|
string
|
Den relativa sökvägen på beräkningsnoden där filsystemet ska monteras
Alla filsystem monteras i förhållande till katalogen Batch-monteringar som är tillgängliga via AZ_BATCH_NODE_MOUNTS_DIR miljövariabeln.
|
sasKey
|
string
|
Sas-token för Azure Storage.
Den här egenskapen är ömsesidigt uteslutande med både accountKey och identitet; exakt ett måste anges.
|
AzureFileShareConfiguration
Information som används för att ansluta till en Azure Fileshare.
Name |
Typ |
Description |
accountKey
|
string
|
Azure Storage-kontonyckeln.
|
accountName
|
string
|
Namnet på Azure Storage-kontot.
|
azureFileUrl
|
string
|
URL:en för Azure Files.
Det här är av formatet "https://{account}.file.core.windows.net/".
|
mountOptions
|
string
|
Ytterligare kommandoradsalternativ för att skicka till monteringskommandot.
Det här är alternativ för "net use" i Windows och "mount"-alternativ i Linux.
|
relativeMountPath
|
string
|
Den relativa sökvägen på beräkningsnoden där filsystemet ska monteras
Alla filsystem monteras i förhållande till katalogen Batch-monteringar som är tillgängliga via AZ_BATCH_NODE_MOUNTS_DIR miljövariabeln.
|
BatchPoolIdentity
Identiteten för Batch-poolen, om den är konfigurerad. Om poolidentiteten uppdateras under uppdateringen av en befintlig pool kommer endast de nya virtuella datorer som skapas efter att poolen krymper till 0 att ha de uppdaterade identiteterna
Name |
Typ |
Description |
type
|
PoolIdentityType
|
Den typ av identitet som används för Batch-poolen.
|
userAssignedIdentities
|
object
|
Listan över användaridentiteter som är associerade med Batch-poolen.
|
CachingType
Typen av cachelagring som ska aktiveras för disken.
Name |
Typ |
Description |
None
|
string
|
Cachelagringsläget för disken är inte aktiverat.
|
ReadOnly
|
string
|
Cachelagringsläget för disken är skrivskyddat.
|
ReadWrite
|
string
|
Cachelagringsläget för disken är läs- och skrivläge.
|
CertificateReference
En referens till ett certifikat som ska installeras på beräkningsnoder i en pool. Detta måste finnas i samma konto som poolen.
Name |
Typ |
Description |
id
|
string
|
Det fullständigt kvalificerade ID:t för certifikatet som ska installeras i poolen. Detta måste finnas i samma batchkonto som poolen.
|
storeLocation
|
CertificateStoreLocation
|
Platsen för certifikatarkivet på beräkningsnoden där certifikatet ska installeras.
Standardvärdet är currentUser. Den här egenskapen gäller endast för pooler som konfigurerats med Windows-noder (dvs. skapas med cloudServiceConfiguration eller med virtualMachineConfiguration med hjälp av en Windows-avbildningsreferens). För Linux-beräkningsnoder lagras certifikaten i en katalog i aktivitetsarbetskatalogen och en miljövariabel AZ_BATCH_CERTIFICATES_DIR skickas till uppgiften för att fråga efter den här platsen. För certifikat med synlighet för "remoteUser" skapas en "certs"-katalog i användarens hemkatalog (t.ex. /home/{användarnamn}/certifikat) och certifikat placeras i katalogen.
|
storeName
|
string
|
Namnet på certifikatarkivet på beräkningsnoden som certifikatet ska installeras i.
Den här egenskapen gäller endast för pooler som konfigurerats med Windows-noder (dvs. skapat med cloudServiceConfiguration eller med virtualMachineConfiguration med hjälp av en Windows-avbildningsreferens). Vanliga butiksnamn är: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, men alla anpassade butiksnamn kan också användas. Standardvärdet är Min.
|
visibility
|
CertificateVisibility[]
|
Vilka användarkonton på beräkningsnoden ska ha åtkomst till certifikatets privata data.
|
CertificateStoreLocation
Platsen för certifikatarkivet på beräkningsnoden där certifikatet ska installeras.
Name |
Typ |
Description |
CurrentUser
|
string
|
Certifikat ska installeras i CurrentUser-certifikatarkivet.
|
LocalMachine
|
string
|
Certifikat ska installeras i LocalMachine-certifikatarkivet.
|
CertificateVisibility
Vilka användarkonton på beräkningsnoden ska ha åtkomst till certifikatets privata data.
Name |
Typ |
Description |
RemoteUser
|
string
|
Certifikatet ska vara synligt för de användarkonton under vilka användare fjärråtkomst till noden.
|
StartTask
|
string
|
Certifikatet ska vara synligt för användarkontot under vilket startaktiviteten körs. Observera att om autoanvändaromfånget är pool för både StartTask och en aktivitet visas även det här certifikatet för aktiviteten.
|
Task
|
string
|
Certifikatet ska vara synligt för de användarkonton under vilka jobbaktiviteter körs.
|
CIFSMountConfiguration
Information som används för att ansluta till ett CIFS-filsystem.
Name |
Typ |
Description |
mountOptions
|
string
|
Ytterligare kommandoradsalternativ för att skicka till monteringskommandot.
Det här är alternativ för "net use" i Windows och "mount"-alternativ i Linux.
|
password
|
string
|
Lösenordet som ska användas för autentisering mot CIFS-filsystemet.
|
relativeMountPath
|
string
|
Den relativa sökvägen på beräkningsnoden där filsystemet ska monteras
Alla filsystem monteras i förhållande till katalogen Batch-monteringar som är tillgängliga via AZ_BATCH_NODE_MOUNTS_DIR miljövariabeln.
|
source
|
string
|
URI:n för filsystemet som ska monteras.
|
userName
|
string
|
Användaren som ska användas för autentisering mot CIFS-filsystemet.
|
CloudError
Ett felsvar från Batch-tjänsten.
Name |
Typ |
Description |
error
|
CloudErrorBody
|
Brödtexten i felsvaret.
|
CloudErrorBody
Ett felsvar från Batch-tjänsten.
Name |
Typ |
Description |
code
|
string
|
En identifierare för felet. Koder är invarianta och är avsedda att användas programmatiskt.
|
details
|
CloudErrorBody[]
|
En lista med ytterligare information om felet.
|
message
|
string
|
Ett meddelande som beskriver felet, avsett att vara lämpligt för visning i ett användargränssnitt.
|
target
|
string
|
Målet för det specifika felet. Till exempel namnet på egenskapen i fel.
|
CloudServiceConfiguration
Konfigurationen för noder i en pool baserat på Azure Cloud Services-plattformen.
Name |
Typ |
Description |
osFamily
|
string
|
Azure Guest OS-familjen som ska installeras på de virtuella datorerna i poolen.
Möjliga värden är: 2 – OS Family 2, motsvarande Windows Server 2008 R2 SP1. 3 – OS Family 3, motsvarande Windows Server 2012. 4 – OS Family 4, motsvarande Windows Server 2012 R2. 5 – OS Family 5, motsvarande Windows Server 2016. 6 – OS Family 6, motsvarande Windows Server 2019. Mer information finns i Azure Guest OS Releases (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases).
|
osVersion
|
string
|
Den Azure Guest OS-version som ska installeras på de virtuella datorerna i poolen.
Standardvärdet är * som anger den senaste operativsystemversionen för den angivna operativsystemfamiljen.
|
ComputeNodeDeallocationOption
Avgör vad du ska göra med en nod och dess aktiviteter som körs när den har valts för frigöring.
Name |
Typ |
Description |
Requeue
|
string
|
Avsluta aktivitetsprocesser som körs och skicka aktiviteterna på nytt. Aktiviteterna körs igen när en nod är tillgänglig. Ta bort noder så snart aktiviteterna har avslutats.
|
RetainedData
|
string
|
Tillåt att aktiviteter som körs för närvarande slutförs och vänta tills alla kvarhållningsperioder för uppgiftsdata upphör att gälla. Schemalägg inga nya aktiviteter medan du väntar. Ta bort noder när alla kvarhållningsperioder för aktiviteter har upphört att gälla.
|
TaskCompletion
|
string
|
Tillåt att aktiviteter som körs för närvarande slutförs. Schemalägg inga nya aktiviteter medan du väntar. Ta bort noder när alla aktiviteter har slutförts.
|
Terminate
|
string
|
Avsluta aktiviteter som körs. Aktiviteterna slutförs med failureInfo som anger att de har avslutats och inte körs igen. Ta bort noder så snart aktiviteterna har avslutats.
|
ComputeNodeFillType
Hur aktiviteter ska distribueras mellan beräkningsnoder.
Name |
Typ |
Description |
Pack
|
string
|
Så många aktiviteter som möjligt (taskSlotsPerNode) bör tilldelas till varje nod i poolen innan några aktiviteter tilldelas till nästa nod i poolen.
|
Spread
|
string
|
Aktiviteter bör tilldelas jämnt över alla noder i poolen.
|
ComputeNodeIdentityReference
Referensen till en användartilldelad identitet som är associerad med batchpoolen som en beräkningsnod ska använda.
Name |
Typ |
Description |
resourceId
|
string
|
ARM-resurs-ID för den användartilldelade identiteten.
|
ContainerConfiguration
Konfigurationen för containeraktiverade pooler.
Name |
Typ |
Description |
containerImageNames
|
string[]
|
Samlingen med containeravbildningsnamn.
Det här är den fullständiga avbildningsreferensen, som skulle anges till "docker pull". En avbildning kommer att hämtas från docker-standardregistret om inte avbildningen är fullständigt kvalificerad med ett alternativt register.
|
containerRegistries
|
ContainerRegistry[]
|
Ytterligare privata register från vilka containrar kan hämtas.
Om några avbildningar måste laddas ned från ett privat register som kräver autentiseringsuppgifter måste dessa autentiseringsuppgifter anges här.
|
type
|
ContainerType
|
Containertekniken som ska användas.
|
ContainerRegistry
Ett privat containerregister.
Name |
Typ |
Description |
identityReference
|
ComputeNodeIdentityReference
|
Referensen till den användartilldelade identitet som ska användas för att komma åt en Azure Container Registry i stället för användarnamn och lösenord.
Referensen till en användartilldelad identitet som är associerad med batchpoolen som en beräkningsnod ska använda.
|
password
|
string
|
Lösenordet för att logga in på registerservern.
|
registryServer
|
string
|
Registrets URL.
Om det utelämnas är standardvärdet "docker.io".
|
username
|
string
|
Användarnamnet för att logga in på registerservern.
|
ContainerType
Containertekniken som ska användas.
Name |
Typ |
Description |
CriCompatible
|
string
|
En CRI-baserad teknik kommer att användas för att starta containrarna.
|
DockerCompatible
|
string
|
En Docker-kompatibel containerteknik används för att starta containrarna.
|
ContainerWorkingDirectory
En flagga som anger var containeruppgiftens arbetskatalog finns. Standardvärdet är "taskWorkingDirectory".
Name |
Typ |
Description |
ContainerImageDefault
|
string
|
Använda containeravbildningsdefinierad arbetskatalog. Se upp för att den här katalogen inte innehåller de resursfiler som laddats ned av Batch.
|
TaskWorkingDirectory
|
string
|
Använd arbetskatalogen för batchtjänstens standarduppgift, som innehåller resursfilerna för aktiviteten som fylls i av Batch.
|
DataDisk
Inställningar som ska användas av de datadiskar som är associerade med beräkningsnoder i poolen. När du använder anslutna datadiskar måste du montera och formatera diskarna inifrån en virtuell dator för att kunna använda dem.
Name |
Typ |
Description |
caching
|
CachingType
|
Den typ av cachelagring som ska aktiveras för datadiskarna.
Värden är:
none – Cachelagringsläget för disken är inte aktiverat.
readOnly – cachelagringsläget för disken är skrivskyddat.
readWrite – cachelagringsläget för disken är läs- och skrivläge.
Standardvärdet för cachelagring är inget. Information om alternativen för cachelagring finns i: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/.
|
diskSizeGB
|
integer
|
Den ursprungliga diskstorleken i GB när du skapar en ny datadisk.
|
lun
|
integer
|
Det logiska enhetsnumret.
Lun används för att unikt identifiera varje datadisk. Om du ansluter flera diskar bör var och en ha en distinkt lun. Värdet måste vara mellan 0 och 63, inklusive.
|
storageAccountType
|
StorageAccountType
|
Den lagringskontotyp som ska användas för datadisken.
Om det utelämnas är standardvärdet "Standard_LRS". Värden är:
Standard_LRS – Datadisken bör använda lokalt redundant standardlagring.
Premium_LRS – Datadisken bör använda lokalt redundant premiumlagring.
|
DeploymentConfiguration
Egenskaper för distributionskonfiguration.
Name |
Typ |
Description |
cloudServiceConfiguration
|
CloudServiceConfiguration
|
Molntjänstkonfigurationen för poolen.
Den här egenskapen och virtualMachineConfiguration är ömsesidigt uteslutande och en av egenskaperna måste anges. Det går inte att ange den här egenskapen om Batch-kontot skapades med egenskapen poolAllocationMode inställd på "UserSubscription".
|
virtualMachineConfiguration
|
VirtualMachineConfiguration
|
Konfigurationen av den virtuella datorn för poolen.
Den här egenskapen och cloudServiceConfiguration är ömsesidigt uteslutande och en av egenskaperna måste anges.
|
DiffDiskPlacement
Anger den tillfälliga diskplaceringen för operativsystemdisken för alla virtuella datorer i poolen.
Name |
Typ |
Description |
CacheDisk
|
string
|
Den tillfälliga OS-disken lagras i den virtuella datorns cacheminne.
|
DiffDiskSettings
Anger tillfälliga diskinställningar för den operativsystemdisk som används av den virtuella datorn.
DiskEncryptionConfiguration
Diskkrypteringskonfigurationen som tillämpas på beräkningsnoder i poolen. Diskkrypteringskonfiguration stöds inte i En Linux-pool som skapats med Virtual Machine Image eller Azure Compute Gallery Image.
Name |
Typ |
Description |
targets
|
DiskEncryptionTarget[]
|
Listan över diskmål Batch Service krypterar på beräkningsnoden
I Linux-poolen stöds endast "TemporaryDisk". i Windows-poolen måste "OsDisk" och "TemporaryDisk" anges.
|
DiskEncryptionTarget
Listan över diskmål Batch Service krypterar på beräkningsnoden
Name |
Typ |
Description |
OsDisk
|
string
|
OS-disken på beräkningsnoden är krypterad.
|
TemporaryDisk
|
string
|
Den tillfälliga disken på beräkningsnoden krypteras. I Linux gäller den här krypteringen för andra partitioner (till exempel de på monterade datadiskar) när kryptering sker vid start.
|
DynamicVNetAssignmentScope
Omfånget för dynamisk vnet-tilldelning.
Name |
Typ |
Description |
job
|
string
|
Dynamisk VNet-tilldelning görs per jobb. Om det här värdet anges måste även nätverkskonfigurationens undernäts-ID anges. Den här funktionen kräver godkännande före användning. Kontakta supporten
|
none
|
string
|
Ingen dynamisk VNet-tilldelning är aktiverad.
|
ElevationLevel
Användarens höjdnivå.
Name |
Typ |
Description |
Admin
|
string
|
Användaren är en användare med förhöjd åtkomst och fungerar med fullständiga administratörsbehörigheter.
|
NonAdmin
|
string
|
Användaren är en standardanvändare utan förhöjd åtkomst.
|
EnvironmentSetting
En miljövariabel som ska anges i en uppgiftsprocess.
Name |
Typ |
Description |
name
|
string
|
Namnet på miljövariabeln.
|
value
|
string
|
Värdet för miljövariabeln.
|
FixedScaleSettings
Fasta skalningsinställningar för poolen.
Name |
Typ |
Standardvärde |
Description |
nodeDeallocationOption
|
ComputeNodeDeallocationOption
|
|
Avgör vad du ska göra med en nod och dess aktiviteter som körs om poolstorleken minskar.
Om det utelämnas är standardvärdet Requeue.
|
resizeTimeout
|
string
|
PT15M
|
Tidsgränsen för allokering av beräkningsnoder till poolen.
Standardvärdet är 15 minuter. Timeout-värden använder ISO 8601-format. Använd till exempel PT10M i 10 minuter. Det minsta värdet är 5 minuter. Om du anger ett värde som är mindre än 5 minuter avvisar Batch-tjänsten begäran med ett fel. om du anropar REST API direkt är HTTP-statuskoden 400 (felaktig begäran).
|
targetDedicatedNodes
|
integer
|
|
Önskat antal dedikerade beräkningsnoder i poolen.
Minst en av targetDedicatedNodes, targetLowPriorityNodes måste anges.
|
targetLowPriorityNodes
|
integer
|
|
Önskat antal beräkningsnoder med oanvänd kapacitet/låg prioritet i poolen.
Minst en av targetDedicatedNodes, targetLowPriorityNodes måste anges.
|
ImageReference
En referens till en Azure Virtual Machines Marketplace-avbildning eller Azure Image-resursen för en anpassad virtuell dator. Information om hur du hämtar listan över alla imageReferences som verifierats av Azure Batch finns i åtgärden "List supported node agent SKU:er".
Name |
Typ |
Description |
id
|
string
|
ARM-resursidentifieraren för Azure Compute Gallery Image. Beräkningsnoder i poolen skapas med det här avbildnings-ID:t. Det här är i formuläret /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{versionId}.
Den här egenskapen är ömsesidigt uteslutande med andra egenskaper. Azure Compute Gallery-avbildningen måste ha repliker i samma region som Azure Batch-kontot. Information om brandväggsinställningarna för Batch-nodagenten som ska kommunicera med Batch-tjänsten finns https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configurationi .
|
offer
|
string
|
Erbjudandetypen för Azure Virtual Machines Marketplace-avbildningen.
Till exempel UbuntuServer eller WindowsServer.
|
publisher
|
string
|
Utgivaren av Azure Virtual Machines Marketplace-avbildningen.
Till exempel Canonical eller MicrosoftWindowsServer.
|
sku
|
string
|
SKU:n för Azure Virtual Machines Marketplace-avbildningen.
Till exempel 18.04-LTS eller 2022-datacenter.
|
version
|
string
|
Versionen av Azure Virtual Machines Marketplace-avbildningen.
Du kan ange värdet "senaste" för att välja den senaste versionen av en avbildning. Om det utelämnas är standardvärdet "senaste".
|
InboundEndpointProtocol
Protokollet för slutpunkten.
Name |
Typ |
Description |
TCP
|
string
|
Använd TCP för slutpunkten.
|
UDP
|
string
|
Använd UDP för slutpunkten.
|
InboundNatPool
En inkommande NAT-pool som kan användas för att adressera specifika portar på beräkningsnoder i en Batch-pool externt.
Name |
Typ |
Description |
backendPort
|
integer
|
Portnumret på beräkningsnoden.
Detta måste vara unikt i en Batch-pool. Godtagbara värden är mellan 1 och 65535 förutom för 22, 3389, 29876 och 29877 eftersom dessa är reserverade. Om några reserverade värden anges misslyckas begäran med HTTP-statuskod 400.
|
frontendPortRangeEnd
|
integer
|
Det sista portnumret i intervallet för externa portar som ska användas för att ge inkommande åtkomst till backendPort på enskilda beräkningsnoder.
Acceptabla värden sträcker sig mellan 1 och 65534 utom portar från 50000 till 55000 som är reserverade av Batch-tjänsten. Alla intervall i en pool måste vara distinkta och får inte överlappa varandra. Om några reserverade eller överlappande värden tillhandahålls misslyckas begäran med HTTP-statuskod 400.
|
frontendPortRangeStart
|
integer
|
Det första portnumret i intervallet för externa portar som ska användas för att ge inkommande åtkomst till backendPort på enskilda beräkningsnoder.
Godtagbara värden sträcker sig mellan 1 och 65534 utom portar från 50000 till 55000 som är reserverade. Alla intervall i en pool måste vara distinkta och får inte överlappa varandra. Om några reserverade eller överlappande värden tillhandahålls misslyckas begäran med HTTP-statuskod 400.
|
name
|
string
|
Namnet på slutpunkten.
Namnet måste vara unikt i en Batch-pool, kan innehålla bokstäver, siffror, understreck, punkter och bindestreck. Namn måste börja med en bokstav eller ett tal, måste sluta med en bokstav, ett tal eller ett understreck och får inte överstiga 77 tecken. Om ogiltiga värden anges misslyckas begäran med HTTP-statuskod 400.
|
networkSecurityGroupRules
|
NetworkSecurityGroupRule[]
|
En lista över regler för nätverkssäkerhetsgrupper som ska tillämpas på slutpunkten.
Det maximala antalet regler som kan anges för alla slutpunkter i en Batch-pool är 25. Om inga regler för nätverkssäkerhetsgrupper anges skapas en standardregel som tillåter inkommande åtkomst till den angivna backendPort. Om det maximala antalet regler för nätverkssäkerhetsgrupper överskrids misslyckas begäran med HTTP-statuskod 400.
|
protocol
|
InboundEndpointProtocol
|
Protokollet för slutpunkten.
|
InterNodeCommunicationState
Om poolen tillåter direkt kommunikation mellan noder.
Name |
Typ |
Description |
Disabled
|
string
|
Inaktivera nätverkskommunikation mellan virtuella datorer.
|
Enabled
|
string
|
Aktivera nätverkskommunikation mellan virtuella datorer.
|
IPAddressProvisioningType
Etableringstypen för offentliga IP-adresser för Batch-poolen.
Name |
Typ |
Description |
BatchManaged
|
string
|
En offentlig IP-adress skapas och hanteras av Batch. Det kan finnas flera offentliga IP-adresser beroende på poolens storlek.
|
NoPublicIPAddresses
|
string
|
Ingen offentlig IP-adress skapas för beräkningsnoderna i poolen.
|
UserManaged
|
string
|
Offentliga IP-adresser tillhandahålls av användaren och används för att etablera beräkningsnoderna.
|
LinuxUserConfiguration
Egenskaper som används för att skapa ett användarkonto på en Linux-nod.
Name |
Typ |
Description |
gid
|
integer
|
Grupp-ID för användarkontot.
Egenskaperna uid och gid måste anges tillsammans eller inte alls. Om det inte anges väljer det underliggande operativsystemet gid.
|
sshPrivateKey
|
string
|
Den privata SSH-nyckeln för användarkontot.
Den privata nyckeln får inte vara lösenordsskyddad. Den privata nyckeln används för att automatiskt konfigurera asymmetrisk-nyckelbaserad autentisering för SSH mellan noder i en Linux-pool när poolens enableInterNodeCommunication-egenskap är sann (den ignoreras om enableInterNodeCommunication är falskt). Det gör det genom att placera nyckelparet i användarens .ssh-katalog. Om inget anges konfigureras inte lösenordsfri SSH mellan noder (ingen ändring av användarens .ssh-katalog görs).
|
uid
|
integer
|
Användarkontots användar-ID.
Egenskaperna uid och gid måste anges tillsammans eller inte alls. Om det inte anges väljer det underliggande operativsystemet uid.
|
LoginMode
Inloggningsläge för användare
Name |
Typ |
Description |
Batch
|
string
|
Inloggningsläget LOGON32_LOGON_BATCH Win32. Batchinloggningsläget rekommenderas för långvariga parallella processer.
|
Interactive
|
string
|
Inloggningsläget LOGON32_LOGON_INTERACTIVE Win32. Vissa program kräver behörigheter som är associerade med det interaktiva inloggningsläget. Om så är fallet för ett program som används i din uppgift rekommenderas det här alternativet.
|
ManagedDisk
Name |
Typ |
Description |
storageAccountType
|
StorageAccountType
|
Lagringskontotypen för hanterad disk.
|
Ett namn/värde-par som är associerat med en Batch-tjänstresurs.
Name |
Typ |
Description |
name
|
string
|
Namnet på metadataobjektet.
|
value
|
string
|
Värdet för metadataobjektet.
|
MountConfiguration
Filsystemet som ska monteras på varje nod.
Name |
Typ |
Description |
azureBlobFileSystemConfiguration
|
AzureBlobFileSystemConfiguration
|
Azure Storage-containern som ska monteras med blob-FUSE på varje nod.
Den här egenskapen är ömsesidigt uteslutande med alla andra egenskaper.
|
azureFileShareConfiguration
|
AzureFileShareConfiguration
|
Azure-filresursen som ska monteras på varje nod.
Den här egenskapen är ömsesidigt uteslutande med alla andra egenskaper.
|
cifsMountConfiguration
|
CIFSMountConfiguration
|
CIFS/SMB-filsystemet som ska monteras på varje nod.
Den här egenskapen är ömsesidigt uteslutande med alla andra egenskaper.
|
nfsMountConfiguration
|
NFSMountConfiguration
|
NFS-filsystemet som ska monteras på varje nod.
Den här egenskapen är ömsesidigt uteslutande med alla andra egenskaper.
|
NetworkConfiguration
Nätverkskonfigurationen för en pool.
Name |
Typ |
Standardvärde |
Description |
dynamicVnetAssignmentScope
|
DynamicVNetAssignmentScope
|
none
|
Omfånget för dynamisk vnet-tilldelning.
|
enableAcceleratedNetworking
|
boolean
|
|
Om den här poolen ska aktivera accelererat nätverk.
Accelererat nätverk möjliggör enkel rot-I/O-virtualisering (SR-IOV) till en virtuell dator, vilket kan leda till bättre nätverksprestanda. Mer information finns i: https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview.
|
endpointConfiguration
|
PoolEndpointConfiguration
|
|
Konfigurationen för slutpunkter på beräkningsnoder i Batch-poolen.
Konfiguration av poolslutpunkter stöds bara i pooler med egenskapen virtualMachineConfiguration.
|
publicIPAddressConfiguration
|
PublicIPAddressConfiguration
|
|
Den offentliga IPAddress-konfigurationen för beräkningsnoder i Batch-poolen.
Den här egenskapen stöds endast för pooler med egenskapen virtualMachineConfiguration.
|
subnetId
|
string
|
|
ARM-resursidentifieraren för det virtuella nätverksundernätet som poolens beräkningsnoder ansluter till. Det här är formuläret /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}.
Det virtuella nätverket måste finnas i samma region och prenumeration som det Azure Batch kontot. Det angivna undernätet bör ha tillräckligt med kostnadsfria IP-adresser för att hantera antalet noder i poolen. Om undernätet inte har tillräckligt med kostnadsfria IP-adresser allokerar poolen delvis beräkningsnoder och ett storleksändringsfel uppstår. Tjänstens huvudnamn för MicrosoftAzureBatch måste ha rollen "Klassisk virtuell datordeltagare" Role-Based Access Control (RBAC) för det angivna virtuella nätverket. Det angivna undernätet måste tillåta kommunikation från Azure Batch-tjänsten för att kunna schemalägga aktiviteter på beräkningsnoderna. Detta kan verifieras genom att kontrollera om det angivna virtuella nätverket har några associerade nätverkssäkerhetsgrupper (NSG). Om kommunikationen till beräkningsnoderna i det angivna undernätet nekas av en NSG anger Batch-tjänsten beräkningsnodernas tillstånd till oanvändbart. Om det angivna virtuella nätverket har associerade nätverkssäkerhetsgrupper (NSG) måste ett par reserverade systemportar vara aktiverade för inkommande kommunikation. För pooler som har skapats med en konfiguration av virtuell dator aktiverar du portarna 29876 och 29877, samt port 22 för Linux och port 3389 för Windows. För pooler som har skapats med en molntjänstkonfiguration aktiverar du portarna 10100, 20100 och 30100. Aktivera även utgående anslutningar till Azure Storage på port 443. För cloudServiceConfiguration-pooler stöds endast "klassiska" virtuella nätverk. Mer information finns i: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration
|
NetworkSecurityGroupRule
En regel för nätverkssäkerhetsgrupp som ska tillämpas på en inkommande slutpunkt.
Name |
Typ |
Description |
access
|
NetworkSecurityGroupRuleAccess
|
Den åtgärd som ska vidtas för en angiven IP-adress, ett undernätsintervall eller en tagg.
|
priority
|
integer
|
Prioriteten för den här regeln.
Prioriteringarna i en pool måste vara unika och utvärderas i prioritetsordning. Desto lägre är talet, desto högre prioritet. Regler kan till exempel anges med ordernummer 150, 250 och 350. Regeln med ordernumret 150 har företräde framför regeln som har en ordning på 250. Tillåtna prioriteringar är mellan 150 och 4 096. Om några reserverade eller duplicerade värden anges misslyckas begäran med HTTP-statuskod 400.
|
sourceAddressPrefix
|
string
|
Källadressprefixet eller taggen som ska matchas för regeln.
Giltiga värden är en enskild IP-adress (dvs. 10.10.10.10), IP-undernät (dvs. 192.168.1.0/24), standardtagg eller * (för alla adresser). Om andra värden anges misslyckas begäran med HTTP-statuskod 400.
|
sourcePortRanges
|
string[]
|
Källportintervallen som ska matchas för regeln.
Giltiga värden är "*" (för alla portar 0–65535) eller matriser med portar eller portintervall (dvs. 100–200). Portarna ska vara mellan 0 och 65535 och portintervallen eller portarna får inte överlappa varandra. Om andra värden anges misslyckas begäran med HTTP-statuskod 400. Standardvärdet är *.
|
NetworkSecurityGroupRuleAccess
Den åtgärd som ska vidtas för en angiven IP-adress, ett undernätsintervall eller en tagg.
Name |
Typ |
Description |
Allow
|
string
|
Tillåt åtkomst.
|
Deny
|
string
|
Neka åtkomst.
|
NFSMountConfiguration
Information som används för att ansluta till ett NFS-filsystem.
Name |
Typ |
Description |
mountOptions
|
string
|
Ytterligare kommandoradsalternativ för att skicka till monteringskommandot.
Det här är alternativ för "net use" i Windows och "mount"-alternativ i Linux.
|
relativeMountPath
|
string
|
Den relativa sökvägen på beräkningsnoden där filsystemet ska monteras
Alla filsystem monteras i förhållande till katalogen Batch-monteringar som är tillgängliga via AZ_BATCH_NODE_MOUNTS_DIR miljövariabeln.
|
source
|
string
|
URI:n för filsystemet som ska monteras.
|
NodeCommunicationMode
Avgör hur en pool kommunicerar med Batch-tjänsten.
Name |
Typ |
Description |
Classic
|
string
|
Noder som använder det klassiska kommunikationsläget kräver inkommande TCP-kommunikation på portarna 29876 och 29877 från "BatchNodeManagement. {region}"-tjänsttagg och utgående TCP-kommunikation på port 443 till "Storage.region" och "BatchNodeManagement. {region}" tjänsttaggar.
|
Default
|
string
|
Nodkommunikationsläget anges automatiskt av Batch-tjänsten.
|
Simplified
|
string
|
Noder som använder det förenklade kommunikationsläget kräver utgående TCP-kommunikation på port 443 till "BatchNodeManagement. {region}" tjänsttagg. Inga öppna inkommande portar krävs.
|
NodePlacementConfiguration
Konfiguration av nodplacering för batchpooler.
Name |
Typ |
Description |
policy
|
NodePlacementPolicyType
|
Principtyp för nodplacering i Batch-pooler.
Allokeringsprincip som används av Batch Service för att etablera noderna. Om det inte anges använder Batch regionalprincipen.
|
NodePlacementPolicyType
Placeringsprincipen för allokering av noder i poolen.
Name |
Typ |
Description |
Regional
|
string
|
Alla noder i poolen allokeras i samma region.
|
Zonal
|
string
|
Noder i poolen kommer att spridas över olika zoner med bästa möjliga balansering.
|
OSDisk
Inställningar för den virtuella datorns operativsystemdisk.
Name |
Typ |
Description |
caching
|
CachingType
|
Anger cachelagringskraven. Möjliga värden är: None, ReadOnly, ReadWrite. Standardvärdena är: Ingen för Standard Storage. ReadOnly för Premium Storage.
|
diskSizeGB
|
integer
|
Den ursprungliga diskstorleken i GB när du skapar en ny OS-disk.
|
ephemeralOSDiskSettings
|
DiffDiskSettings
|
Anger tillfälliga diskinställningar för den operativsystemdisk som används av den virtuella datorn.
|
managedDisk
|
ManagedDisk
|
Parametrarna för hanterade diskar.
|
writeAcceleratorEnabled
|
boolean
|
Anger om writeAccelerator ska aktiveras eller inaktiveras på disken.
|
Pool
Innehåller information om en pool.
Name |
Typ |
Standardvärde |
Description |
etag
|
string
|
|
ETag för resursen som används för samtidighetsinstruktioner.
|
id
|
string
|
|
Resursens ID.
|
identity
|
BatchPoolIdentity
|
|
Den typ av identitet som används för Batch-poolen.
Den typ av identitet som används för Batch-poolen.
|
name
|
string
|
|
Namnet på resursen.
|
properties.allocationState
|
AllocationState
|
|
Om poolen ändrar storlek.
|
properties.allocationStateTransitionTime
|
string
|
|
Den tid då poolen övergick till det aktuella allokeringstillståndet.
|
properties.applicationLicenses
|
string[]
|
|
Listan över programlicenser som Batch-tjänsten gör tillgängliga på varje beräkningsnod i poolen.
Listan över programlicenser måste vara en delmängd av tillgängliga Batch-tjänstprogramlicenser. Om en licens begärs som inte stöds misslyckas skapandet av poolen.
|
properties.applicationPackages
|
ApplicationPackageReference[]
|
|
Listan över programpaket som ska installeras på varje beräkningsnod i poolen.
Ändringar av programpaketreferenser påverkar alla nya beräkningsnoder som ansluter till poolen, men påverkar inte beräkningsnoder som redan finns i poolen förrän de startas om eller avfinns på nytt. Det finns högst 10 programpaketreferenser i en viss pool.
|
properties.autoScaleRun
|
AutoScaleRun
|
|
Resultat och fel från den senaste körningen av autoskalningsformeln.
Den här egenskapen anges endast om poolen skalar automatiskt, d.v.s. autoScaleSettings används.
|
properties.certificates
|
CertificateReference[]
|
|
Listan över certifikat som ska installeras på varje beräkningsnod i poolen.
För Windows-beräkningsnoder installerar Batch-tjänsten certifikaten till det angivna certifikatarkivet och platsen. För Linux-beräkningsnoder lagras certifikaten i en katalog i aktivitetsarbetskatalogen och en miljövariabel AZ_BATCH_CERTIFICATES_DIR skickas till uppgiften för att fråga efter den här platsen. För certifikat med synligheten "remoteUser" skapas en "certs"-katalog i användarens hemkatalog (t.ex. /home/{user-name}/certs) och certifikat placeras i den katalogen.
Varning! Den här egenskapen är inaktuell och tas bort efter februari 2024. Använd Azure KeyVault-tillägget i stället.
|
properties.creationTime
|
string
|
|
Skapandetiden för poolen.
|
properties.currentDedicatedNodes
|
integer
|
|
Antalet dedikerade beräkningsnoder som för närvarande finns i poolen.
|
properties.currentLowPriorityNodes
|
integer
|
|
Antalet beräkningsnoder med oanvänd kapacitet/låg prioritet som för närvarande finns i poolen.
|
properties.currentNodeCommunicationMode
|
NodeCommunicationMode
|
|
Det aktuella tillståndet för poolkommunikationsläget.
|
properties.deploymentConfiguration
|
DeploymentConfiguration
|
|
Den här egenskapen beskriver hur poolnoderna ska distribueras – med hjälp av Cloud Services eller Virtual Machines.
Med CloudServiceConfiguration anges att noderna ska skapas med Hjälp av Azure Cloud Services (PaaS), medan VirtualMachineConfiguration använder Azure Virtual Machines (IaaS).
|
properties.displayName
|
string
|
|
Visningsnamnet för poolen.
Visningsnamnet behöver inte vara unikt och kan innehålla unicode-tecken upp till en maximal längd på 1 024.
|
properties.interNodeCommunication
|
InterNodeCommunicationState
|
|
Om poolen tillåter direkt kommunikation mellan noder.
Detta medför begränsningar för vilka noder som kan tilldelas till poolen. Om du aktiverar det här värdet kan du minska risken för att det begärda antalet noder allokeras i poolen. Om det inte anges är det här värdet som standard inaktiverat.
|
properties.lastModified
|
string
|
|
Den senaste ändringstiden för poolen.
Det här är den sista gången data på poolnivå, till exempel targetDedicatedNodes eller autoScaleSettings, ändrades. Den tar inte hänsyn till ändringar på nodnivå, till exempel ett ändringstillstånd för beräkningsnoder.
|
properties.metadata
|
MetadataItem[]
|
|
En lista över namn/värde-par som är associerade med poolen som metadata.
Batch-tjänsten tilldelar ingen mening till metadata. endast för användning av användarkod.
|
properties.mountConfiguration
|
MountConfiguration[]
|
|
En lista över filsystem som ska monteras på varje nod i poolen.
Detta stöder Azure Files, NFS, CIFS/SMB och Blobfuse.
|
properties.networkConfiguration
|
NetworkConfiguration
|
|
Nätverkskonfigurationen för poolen.
Nätverkskonfigurationen för en pool.
|
properties.provisioningState
|
PoolProvisioningState
|
|
Poolens aktuella tillstånd.
|
properties.provisioningStateTransitionTime
|
string
|
|
Den tid då poolen övergick till sitt aktuella tillstånd.
|
properties.resizeOperationStatus
|
ResizeOperationStatus
|
|
Innehåller information om den aktuella eller senast slutförda storleksändringsåtgärden.
Beskriver antingen den aktuella åtgärden (om poolen AllocationState ändrar storlek) eller den tidigare slutförda åtgärden (om AllocationState är stabil).
|
properties.resourceTags
|
object
|
|
De användardefinierade taggar som är associerade med poolen.
De användardefinierade taggar som ska associeras med Azure Batch-poolen. När de här taggarna anges sprids de till de Azure-resurser som stöds som är associerade med poolen. Den här egenskapen kan bara anges när Batch-kontot skapades med egenskapen poolAllocationMode inställd på UserSubscription.
|
properties.scaleSettings
|
ScaleSettings
|
|
Inställningar som konfigurerar antalet noder i poolen.
Definierar poolens önskade storlek. Detta kan antingen vara "fixedScale" där det begärda targetDedicatedNodes har angetts, eller "autoScale" som definierar en formel som regelbundet omvärderas. Om den här egenskapen inte anges har poolen en fast skala med 0 targetDedicatedNodes.
|
properties.startTask
|
StartTask
|
|
En uppgift som har angetts för att köras på varje beräkningsnod när den ansluter till poolen.
I en PATCH-åtgärd (uppdatering) kan den här egenskapen anges till ett tomt objekt för att ta bort startaktiviteten från poolen.
|
properties.targetNodeCommunicationMode
|
NodeCommunicationMode
|
|
Önskat nodkommunikationsläge för poolen.
Om det utelämnas är standardvärdet Standard.
|
properties.taskSchedulingPolicy
|
TaskSchedulingPolicy
|
|
Hur aktiviteter distribueras mellan beräkningsnoder i en pool.
Om inget anges är standardvärdet utspritt.
|
properties.taskSlotsPerNode
|
integer
|
1
|
Antalet aktivitetsplatser som kan användas för att köra samtidiga aktiviteter på en enda beräkningsnod i poolen.
Standardvärdet är 1. Det maximala värdet är mindre än 4 gånger antalet kärnor i vmSize för poolen eller 256.
|
properties.upgradePolicy
|
UpgradePolicy
|
|
Uppgraderingsprincipen för poolen.
Beskriver en uppgraderingsprincip – automatisk, manuell eller rullande.
|
properties.userAccounts
|
UserAccount[]
|
|
Listan över användarkonton som ska skapas på varje nod i poolen.
|
properties.vmSize
|
string
|
|
Storleken på virtuella datorer i poolen. Alla virtuella datorer i en pool har samma storlek.
Information om tillgängliga storlekar på virtuella datorer för Cloud Services pooler (pooler som skapats med cloudServiceConfiguration) finns i Storlekar för Cloud Services (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch stöder alla Cloud Services VM-storlekar utom ExtraSmall. Information om tillgängliga VM-storlekar för pooler som använder avbildningar från Virtual Machines Marketplace (pooler som skapats med virtualMachineConfiguration) finns i Storlekar för Virtual Machines (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) eller Storlekar för Virtual Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch stöder alla storlekar på virtuella Azure-datorer utom STANDARD_A0 och de med Premium Storage (STANDARD_GS, STANDARD_DS och STANDARD_DSV2-serien).
|
type
|
string
|
|
Resurstypen.
|
PoolEndpointConfiguration
Slutpunktskonfigurationen för en pool.
Name |
Typ |
Description |
inboundNatPools
|
InboundNatPool[]
|
En lista över inkommande NAT-pooler som kan användas för att hantera specifika portar på en enskild beräkningsnod externt.
Det maximala antalet inkommande NAT-pooler per Batch-pool är 5. Om det maximala antalet inkommande NAT-pooler överskrids misslyckas begäran med HTTP-statuskod 400. Detta kan inte anges om IPAddressProvisioningType är NoPublicIPAddresses.
|
PoolIdentityType
Den typ av identitet som används för Batch-poolen.
Name |
Typ |
Description |
None
|
string
|
Batch-poolen har ingen associerad identitet. Om du ställer in None i uppdateringspoolen tas befintliga identiteter bort.
|
UserAssigned
|
string
|
Batch-poolen har användartilldelade identiteter med sig.
|
PoolProvisioningState
Poolens aktuella tillstånd.
Name |
Typ |
Description |
Deleting
|
string
|
Användaren har begärt att poolen ska tas bort, men borttagningsåtgärden har ännu inte slutförts.
|
Succeeded
|
string
|
Poolen är tillgänglig för körning av uppgifter beroende på tillgängligheten för beräkningsnoder.
|
PublicIPAddressConfiguration
Den offentliga IP-adresskonfigurationen för nätverkskonfigurationen för en pool.
Name |
Typ |
Description |
ipAddressIds
|
string[]
|
Listan över offentliga IP-adresser som Batch-tjänsten ska använda vid etablering av beräkningsnoder.
Antalet IP-adresser som anges här begränsar den maximala storleken för poolen – 100 dedikerade noder eller 100 noder med oanvänd kapacitet/låg prioritet kan allokeras för varje offentlig IP-adress. Till exempel skulle en pool som behöver 250 dedikerade virtuella datorer behöva minst 3 offentliga IP-adresser angivna. Varje element i den här samlingen är av formatet: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}.
|
provision
|
IPAddressProvisioningType
|
Etableringstypen för offentliga IP-adresser för poolen
Standardvärdet är BatchManaged
|
ResizeError
Ett fel som uppstod vid storleksändring av en pool.
Name |
Typ |
Description |
code
|
string
|
En identifierare för felet. Koder är invarianta och är avsedda att användas programmatiskt.
|
details
|
ResizeError[]
|
Ytterligare information om felet.
|
message
|
string
|
Ett meddelande som beskriver felet, avsett att vara lämpligt för visning i ett användargränssnitt.
|
ResizeOperationStatus
Information om den aktuella eller senast slutförda storleksändringsåtgärden.
Name |
Typ |
Description |
errors
|
ResizeError[]
|
Information om eventuella fel som påträffades när den senaste storleksändringen utfördes på poolen.
Den här egenskapen anges endast om ett fel uppstod under den senaste poolens storleksändring och endast när poolallokeringstillståndet är Stabilt.
|
nodeDeallocationOption
|
ComputeNodeDeallocationOption
|
Avgör vad du ska göra med en nod och dess aktiviteter som körs om poolstorleken minskar.
Standardvärdet skickas på nytt.
|
resizeTimeout
|
string
|
Tidsgränsen för allokering av beräkningsnoder till poolen eller borttagning av beräkningsnoder från poolen.
Standardvärdet är 15 minuter. Det minsta värdet är 5 minuter. Om du anger ett värde som är mindre än 5 minuter returnerar Batch-tjänsten ett fel. Om du anropar REST-API:et direkt är HTTP-statuskoden 400 (felaktig begäran).
|
startTime
|
string
|
Tidpunkten då åtgärden för att ändra storlek startades.
|
targetDedicatedNodes
|
integer
|
Önskat antal dedikerade beräkningsnoder i poolen.
|
targetLowPriorityNodes
|
integer
|
Önskat antal beräkningsnoder med oanvänd kapacitet/låg prioritet i poolen.
|
ResourceFile
En enda fil eller flera filer som ska laddas ned till en beräkningsnod.
Name |
Typ |
Description |
autoStorageContainerName
|
string
|
Namnet på lagringscontainern i det automatiska lagringskontot.
Egenskaperna autoStorageContainerName, storageContainerUrl och httpUrl är ömsesidigt uteslutande och en av dem måste anges.
|
blobPrefix
|
string
|
Blobprefixet som ska användas vid nedladdning av blobar från en Azure Storage-container. Endast de blobbar vars namn börjar med det angivna prefixet laddas ned.
Egenskapen är endast giltig när autoStorageContainerName eller storageContainerUrl används. Det här prefixet kan vara ett partiellt filnamn eller en underkatalog. Om inget prefix har angetts laddas alla filer i containern ned.
|
fileMode
|
string
|
Attributet för filbehörighetsläge i oktalt format.
Den här egenskapen gäller endast för filer som laddas ned till Linux-beräkningsnoder. Den ignoreras om den anges för en resourceFile som laddas ned till en Windows-nod. Om den här egenskapen inte har angetts för en Linux-nod tillämpas standardvärdet 0770 på filen.
|
filePath
|
string
|
Platsen på beräkningsnoden som filen ska laddas ned till i förhållande till aktivitetens arbetskatalog.
Om egenskapen httpUrl anges krävs filePath och beskriver sökvägen som filen ska laddas ned till, inklusive filnamnet. Om egenskapen autoStorageContainerName eller storageContainerUrl har angetts är filePath valfritt och är den katalog som filerna ska laddas ned till. Om filePath används som en katalog behålls alla katalogstrukturer som redan är associerade med indata i sin helhet och läggs till i den angivna filePath-katalogen. Den angivna relativa sökvägen kan inte bryta sig ut från aktivitetens arbetskatalog (till exempel med hjälp av ..).
|
httpUrl
|
string
|
URL:en för filen som ska laddas ned.
Egenskaperna autoStorageContainerName, storageContainerUrl och httpUrl är ömsesidigt uteslutande och en av dem måste anges. Om URL:en pekar på Azure Blob Storage måste den vara läsbar från beräkningsnoder. Det finns tre sätt att hämta en sådan URL för en blob i Azure Storage: inkludera en signatur för delad åtkomst (SAS) som beviljar läsbehörigheter för bloben, använda en hanterad identitet med läsbehörighet eller ange ACL för bloben eller dess container för att tillåta offentlig åtkomst.
|
identityReference
|
ComputeNodeIdentityReference
|
Referensen till den användartilldelade identitet som ska användas för att komma åt Azure Blob Storage som anges av storageContainerUrl eller httpUrl
Referensen till en användartilldelad identitet som är associerad med batchpoolen som en beräkningsnod ska använda.
|
storageContainerUrl
|
string
|
URL:en för blobcontainern i Azure Blob Storage.
Egenskaperna autoStorageContainerName, storageContainerUrl och httpUrl är ömsesidigt uteslutande och en av dem måste anges. Den här URL:en måste vara läsbar och listbar från beräkningsnoder. Det finns tre sätt att hämta en sådan URL för en container i Azure Storage: inkludera en signatur för delad åtkomst (SAS) som beviljar läs- och listbehörigheter för containern, använder en hanterad identitet med läs- och listbehörigheter eller anger ACL för containern så att den tillåter offentlig åtkomst.
|
RollingUpgradePolicy
De konfigurationsparametrar som används vid löpande uppgradering.
Name |
Typ |
Description |
enableCrossZoneUpgrade
|
boolean
|
Tillåt ATT VMSS ignorerar AZ-gränser när du skapar uppgraderingsbatch. Ta hänsyn till uppdateringsdomänen och maxBatchInstancePercent för att fastställa batchstorleken. Om det här fältet inte har angetts anger Azure Azure Batch inte standardvärdet. Värdet för enableCrossZoneUpgrade på den skapade VirtualMachineScaleSet bestäms av standardkonfigurationerna på VirtualMachineScaleSet. Det här fältet kan bara anges till sant eller falskt när NodePlacementConfiguration används som Zonal.
|
maxBatchInstancePercent
|
integer
|
Den maximala procentandelen av de totala virtuella datorinstanserna som uppgraderas samtidigt av den löpande uppgraderingen i en batch. Eftersom detta är ett maximalt antal felaktiga instanser i tidigare eller framtida batchar kan procentandelen instanser i en batch minska för att säkerställa högre tillförlitlighet. Värdet för det här fältet ska vara mellan 5 och 100, inklusive. Om både maxBatchInstancePercent och maxUnhealthyInstancePercent har tilldelats värdet bör värdet för maxBatchInstancePercent inte vara mer än maxUnhealthyInstancePercent.
|
maxUnhealthyInstancePercent
|
integer
|
Den maximala procentandelen av de totala virtuella datorinstanserna i skalningsuppsättningen som kan vara felfritt samtidigt, antingen på grund av att de har uppgraderats eller genom att hittas i ett feltillstånd av hälsokontrollerna för den virtuella datorn innan den löpande uppgraderingen avbryts. Den här begränsningen kontrolleras innan någon batch startas. Värdet för det här fältet ska vara mellan 5 och 100, inklusive. Om både maxBatchInstancePercent och maxUnhealthyInstancePercent har tilldelats värdet bör värdet för maxBatchInstancePercent inte vara mer än maxUnhealthyInstancePercent.
|
maxUnhealthyUpgradedInstancePercent
|
integer
|
Den maximala procentandelen uppgraderade virtuella datorinstanser som kan konstateras vara i ett feltillstånd. Den här kontrollen utförs när varje batch har uppgraderats. Om den här procentandelen någonsin överskrids avbryts den löpande uppdateringen. Värdet för det här fältet ska vara mellan 0 och 100, inklusive.
|
pauseTimeBetweenBatches
|
string
|
Väntetiden mellan att slutföra uppdateringen för alla virtuella datorer i en batch och att starta nästa batch. Tidsåtgången bör anges i ISO 8601-format.
|
prioritizeUnhealthyInstances
|
boolean
|
Uppgradera alla instanser med feltillstånd i en skalningsuppsättning före eventuella felfria instanser.
|
rollbackFailedInstancesOnPolicyBreach
|
boolean
|
Återställningen misslyckades med instanser till en tidigare modell om principen för löpande uppgradering överträds.
|
ScaleSettings
Skalningsinställningar för poolen
Name |
Typ |
Description |
autoScale
|
AutoScaleSettings
|
Autoskalningsinställningar för poolen.
Den här egenskapen och fixedScale är ömsesidigt uteslutande och en av egenskaperna måste anges.
|
fixedScale
|
FixedScaleSettings
|
Fasta skalningsinställningar för poolen.
Den här egenskapen och autoskalan är ömsesidigt uteslutande och en av egenskaperna måste anges.
|
SecurityProfile
Anger säkerhetsprofilinställningarna för den virtuella datorn eller vm-skalningsuppsättningen.
Name |
Typ |
Description |
encryptionAtHost
|
boolean
|
Den här egenskapen kan användas av användaren i begäran för att aktivera eller inaktivera värdkryptering för den virtuella datorn eller vm-skalningsuppsättningen. Detta aktiverar kryptering för alla diskar, inklusive resurs-/tempdisk på själva värden.
|
securityType
|
SecurityTypes
|
Anger SecurityType för den virtuella datorn. Det måste anges till ett angivet värde för att aktivera UefiSettings.
|
uefiSettings
|
UefiSettings
|
Anger de säkerhetsinställningar som säker start och vTPM som används när den virtuella datorn skapas.
Anger de säkerhetsinställningar som säker start och vTPM som används när den virtuella datorn skapas.
|
SecurityTypes
Anger SecurityType för den virtuella datorn. Det måste anges till ett angivet värde för att aktivera UefiSettings.
Name |
Typ |
Description |
trustedLaunch
|
string
|
Betrodd start skyddar mot avancerade och beständiga angreppstekniker.
|
ServiceArtifactReference
Anger tjänstartefaktreferens-ID:t som används för att ange samma avbildningsversion för alla virtuella datorer i skalningsuppsättningen när du använder den senaste avbildningsversionen.
Name |
Typ |
Description |
id
|
string
|
Tjänstartefaktens referens-ID för ServiceArtifactReference
Referens-ID för tjänstartefakt i form av /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}
|
StartTask
En uppgift som körs när en beräkningsnod ansluter till en pool i Azure Batch-tjänsten, eller när beräkningsnoden startas om eller omskapas.
Name |
Typ |
Standardvärde |
Description |
commandLine
|
string
|
|
Kommandoraden för startaktiviteten.
Kommandoraden körs inte under ett gränssnitt och kan därför inte dra nytta av gränssnittsfunktioner som miljövariabelexpansion. Om du vill dra nytta av sådana funktioner bör du anropa gränssnittet på kommandoraden, till exempel med hjälp av "cmd /c MyCommand" i Windows eller "/bin/sh -c MyCommand" i Linux. Krävs om andra egenskaper för startTask anges.
|
containerSettings
|
TaskContainerSettings
|
|
Inställningarna för containern som startaktiviteten körs under.
När detta anges mappas alla kataloger rekursivt under AZ_BATCH_NODE_ROOT_DIR (roten för Azure Batch kataloger på noden) till containern, alla aktivitetsmiljövariabler mappas till containern och aktivitetskommandoraden körs i containern.
|
environmentSettings
|
EnvironmentSetting[]
|
|
En lista över miljövariabelinställningar för startaktiviteten.
|
maxTaskRetryCount
|
integer
|
0
|
Det maximala antalet gånger som aktiviteten kan försökas igen.
Batch-tjänsten försöker utföra en aktivitet igen om dess slutkod inte är noll. Observera att det här värdet specifikt styr antalet återförsök. Batch-tjänsten försöker utföra uppgiften en gång och kan sedan försöka igen upp till den här gränsen. Om det maximala antalet återförsök till exempel är 3, försöker Batch aktiviteten upp till 4 gånger (ett första försök och 3 återförsök). Om det maximala antalet återförsök är 0 försöker inte Batch-tjänsten uppgiften igen. Om det maximala antalet återförsök är -1 försöker Batch-tjänsten uppgiften igen utan begränsning. Standardvärdet är 0
|
resourceFiles
|
ResourceFile[]
|
|
En lista över filer som Batch-tjänsten laddar ned till beräkningsnoden innan kommandoraden körs.
|
userIdentity
|
UserIdentity
|
|
Användaridentiteten som startaktiviteten körs under.
Om den utelämnas körs aktiviteten som en icke-administrativ användare som är unik för aktiviteten.
|
waitForSuccess
|
boolean
|
|
Om Batch-tjänsten ska vänta tills startaktiviteten har slutförts (d.v.s. avslutas med slutkod 0) innan du schemalägger några aktiviteter på beräkningsnoden.
Om sant och startaktiviteten misslyckas på en beräkningsnod försöker Batch-tjänsten starta aktiviteten igen upp till det maximala antalet återförsök (maxTaskRetryCount). Om aktiviteten fortfarande inte har slutförts efter alla återförsök markerar Batch-tjänsten beräkningsnoden oanvändbar och schemalägger inte aktiviteter till den. Det här villkoret kan identifieras via nodtillståndet och information om schemaläggningsfel. Om det är falskt väntar inte Batch-tjänsten på att startaktiviteten ska slutföras. I det här fallet kan andra aktiviteter börja köras på beräkningsnoden medan startaktiviteten fortfarande körs. och även om startaktiviteten misslyckas fortsätter nya aktiviteter att schemaläggas på noden. Standardvärdet är sant.
|
StorageAccountType
Typ av lagringskonto för användning vid skapande av datadiskar eller OS-diskar.
Name |
Typ |
Description |
Premium_LRS
|
string
|
Datadisken/OS-disken bör använda lokalt redundant premiumlagring.
|
StandardSSD_LRS
|
string
|
Datadisken/OS-disken bör använda lokalt redundant standard-SSD-lagring.
|
Standard_LRS
|
string
|
Datadisken/OS-disken bör använda lokalt redundant standardlagring.
|
TaskContainerSettings
Containerinställningarna för en uppgift.
Name |
Typ |
Description |
containerRunOptions
|
string
|
Ytterligare alternativ för kommandot container create.
Dessa ytterligare alternativ anges som argument till kommandot "docker create", utöver de som styrs av Batch-tjänsten.
|
imageName
|
string
|
Avbildningen som ska användas för att skapa containern där uppgiften ska köras.
Det här är den fullständiga avbildningsreferensen, som skulle anges till "docker pull". Om ingen tagg anges som en del av avbildningsnamnet används taggen ":latest" som standard.
|
registry
|
ContainerRegistry
|
Det privata registret som innehåller containeravbildningen.
Den här inställningen kan utelämnas om den redan angavs när poolen skapades.
|
workingDirectory
|
ContainerWorkingDirectory
|
En flagga som anger var containeruppgiftens arbetskatalog finns. Standardvärdet är "taskWorkingDirectory".
|
TaskSchedulingPolicy
Anger hur aktiviteter ska distribueras mellan beräkningsnoder.
Name |
Typ |
Standardvärde |
Description |
nodeFillType
|
ComputeNodeFillType
|
Spread
|
Hur aktiviteter ska distribueras mellan beräkningsnoder.
|
UefiSettings
Anger de säkerhetsinställningar som säker start och vTPM som används när den virtuella datorn skapas.
Name |
Typ |
Description |
secureBootEnabled
|
boolean
|
Anger om säker start ska aktiveras på den virtuella datorn.
|
vTpmEnabled
|
boolean
|
Anger om vTPM ska aktiveras på den virtuella datorn.
|
UpgradeMode
Anger läget för en uppgradering till virtuella datorer i skalningsuppsättningen.
Möjliga värden:
Manuell – Du styr tillämpningen av uppdateringar av virtuella datorer i skalningsuppsättningen. Du gör detta med hjälp av åtgärden manualUpgrade.
Automatisk – Alla virtuella datorer i skalningsuppsättningen uppdateras automatiskt samtidigt.
Rullande – Skalningsuppsättningen utför uppdateringar i batchar med en valfri paustid däremellan.
Name |
Typ |
Description |
automatic
|
string
|
Alla virtuella datorer i skalningsuppsättningen uppdateras automatiskt samtidigt.
|
manual
|
string
|
Du styr programmet för uppdateringar av virtuella datorer i skalningsuppsättningen. Du gör detta med hjälp av åtgärden manualUpgrade.
|
rolling
|
string
|
De befintliga instanserna i en skalningsuppsättning tas ned i batchar som ska uppgraderas. När den uppgraderade batchen är klar börjar instanserna ta trafik igen och nästa batch börjar. Detta fortsätter tills alla instanser har uppdaterats.
|
UpgradePolicy
Beskriver en uppgraderingsprincip – automatisk, manuell eller rullande.
Name |
Typ |
Description |
automaticOSUpgradePolicy
|
AutomaticOSUpgradePolicy
|
Konfigurationsparametrar som används för att utföra automatisk uppgradering av operativsystemet.
De konfigurationsparametrar som används för att utföra automatisk uppgradering av operativsystemet.
|
mode
|
UpgradeMode
|
Anger läget för en uppgradering till virtuella datorer i skalningsuppsättningen.
Möjliga värden:
Manuell – Du styr tillämpningen av uppdateringar av virtuella datorer i skalningsuppsättningen. Du gör detta med hjälp av åtgärden manualUpgrade.
Automatiskt – Alla virtuella datorer i skalningsuppsättningen uppdateras automatiskt samtidigt.
Rullande – Skalningsuppsättningen utför uppdateringar i batchar med en valfri paustid däremellan.
|
rollingUpgradePolicy
|
RollingUpgradePolicy
|
De konfigurationsparametrar som används vid löpande uppgradering.
Den här egenskapen stöds endast för pooler med egenskapen virtualMachineConfiguration.
|
UserAccount
Egenskaper som används för att skapa en användare på en Azure Batch nod.
Name |
Typ |
Description |
elevationLevel
|
ElevationLevel
|
Behörighetsnivån för användarkontot.
nonAdmin – Den automatiska användaren är en standardanvändare utan förhöjd åtkomst. admin – Den automatiska användaren är en användare med förhöjd åtkomst och fungerar med fullständig administratörsbehörighet. Standardvärdet är nonAdmin.
|
linuxUserConfiguration
|
LinuxUserConfiguration
|
Den Linux-specifika användarkonfigurationen för användarkontot.
Den här egenskapen ignoreras om den anges i en Windows-pool. Om inget anges skapas användaren med standardalternativen.
|
name
|
string
|
Namnet på användarkontot. Namn kan innehålla alla Unicode-tecken upp till en maximal längd på 20.
|
password
|
string
|
Lösenordet för användarkontot.
|
windowsUserConfiguration
|
WindowsUserConfiguration
|
Den Windows-specifika användarkonfigurationen för användarkontot.
Den här egenskapen kan bara anges om användaren finns i en Windows-pool. Om det inte anges och i en Windows-pool skapas användaren med standardalternativen.
|
UserAssignedIdentities
Listan över associerade användaridentiteter.
Name |
Typ |
Description |
clientId
|
string
|
Klient-ID för användartilldelad identitet.
|
principalId
|
string
|
Huvud-ID för användartilldelad identitet.
|
UserIdentity
Definitionen av den användaridentitet som aktiviteten körs under.
Name |
Typ |
Description |
autoUser
|
AutoUserSpecification
|
Den automatiska användare under vilken uppgiften körs.
Egenskaperna userName och autoUser är ömsesidigt uteslutande. du måste ange en men inte båda.
|
userName
|
string
|
Namnet på den användaridentitet som aktiviteten körs under.
Egenskaperna userName och autoUser är ömsesidigt uteslutande. du måste ange en men inte båda.
|
VirtualMachineConfiguration
Konfigurationen för beräkningsnoder i en pool baserat på Azure Virtual Machines-infrastrukturen.
Name |
Typ |
Description |
containerConfiguration
|
ContainerConfiguration
|
Containerkonfigurationen för poolen.
Om det anges utförs konfigurationen på varje nod i poolen så att aktiviteter kan köras i containrar. Alla vanliga uppgifter och jobbhanteraraktiviteter som körs i den här poolen måste ange egenskapen containerSettings och alla andra uppgifter kan ange den.
|
dataDisks
|
DataDisk[]
|
Konfigurationen för datadiskar som är anslutna till beräkningsnoderna i poolen.
Den här egenskapen måste anges om beräkningsnoderna i poolen måste ha tomma datadiskar kopplade till sig.
|
diskEncryptionConfiguration
|
DiskEncryptionConfiguration
|
Diskkrypteringskonfigurationen för poolen.
Om det anges utförs kryptering på varje nod i poolen under nodetablering.
|
extensions
|
VMExtension[]
|
Tillägget för den virtuella datorn för poolen.
Om det anges installeras tilläggen som nämns i den här konfigurationen på varje nod.
|
imageReference
|
ImageReference
|
En referens till Azure Virtual Machines Marketplace Image eller den anpassade virtual machine-avbildningen som ska användas.
|
licenseType
|
string
|
Den typ av lokal licens som ska användas vid distribution av operativsystemet.
Detta gäller endast för avbildningar som innehåller Windows-operativsystemet och bör endast användas när du har giltiga lokala licenser för noderna som ska distribueras. Om detta utelämnas tillämpas ingen lokal licensrabatt. Värden är:
Windows_Server – Den lokala licensen gäller för Windows Server.
Windows_Client – Den lokala licensen gäller för Windows-klienten.
|
nodeAgentSkuId
|
string
|
SKU:n för Batch-nodagenten som ska etableras på beräkningsnoder i poolen.
Batch-nodagenten är ett program som körs på varje nod i poolen och tillhandahåller kommando- och kontrollgränssnittet mellan noden och Batch-tjänsten. Det finns olika implementeringar av nodagenten, så kallade SKU:er, för olika operativsystem. Du måste ange en nodagent-SKU som matchar den valda avbildningsreferensen. Information om hur du hämtar listan över nodagent-SKU:er som stöds tillsammans med deras lista över verifierade bildreferenser finns i åtgärden "List supported node agent SKU:er".
|
nodePlacementConfiguration
|
NodePlacementConfiguration
|
Nodplaceringskonfigurationen för poolen.
Den här konfigurationen anger regler för hur noder i poolen ska allokeras fysiskt.
|
osDisk
|
OSDisk
|
Inställningar för den virtuella datorns operativsystemdisk.
Innehåller konfiguration för tillfälliga OSDisk-inställningar.
|
securityProfile
|
SecurityProfile
|
Anger säkerhetsprofilinställningarna för den virtuella datorn eller vm-skalningsuppsättningen.
Anger säkerhetsprofilinställningarna för den virtuella datorn eller vm-skalningsuppsättningen.
|
serviceArtifactReference
|
ServiceArtifactReference
|
Anger tjänstartefaktreferens-ID:t som används för att ange samma avbildningsversion för alla virtuella datorer i skalningsuppsättningen när du använder den senaste avbildningsversionen.
Referens-ID för tjänstartefakt i form av /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/galleries/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName}
|
windowsConfiguration
|
WindowsConfiguration
|
Inställningar för Windows-operativsystem på den virtuella datorn.
Den här egenskapen får inte anges om imageReference anger en Linux OS-avbildning.
|
VMExtension
Konfigurationen för tillägg för virtuella datorer.
Name |
Typ |
Description |
autoUpgradeMinorVersion
|
boolean
|
Anger om tillägget ska använda en nyare delversion om en är tillgänglig vid distributionstillfället. När tillägget har distribuerats uppgraderas dock inte delversioner om de inte distribueras om, även med den här egenskapen inställd på true.
|
enableAutomaticUpgrade
|
boolean
|
Anger om tillägget ska uppgraderas automatiskt av plattformen om det finns en nyare version av tillägget.
|
name
|
string
|
Namnet på tillägget för den virtuella datorn.
|
protectedSettings
|
object
|
Tillägget kan innehålla antingen protectedSettings eller protectedSettingsFromKeyVault eller inga skyddade inställningar alls.
|
provisionAfterExtensions
|
string[]
|
Samlingen med tilläggsnamn.
Samling med tilläggsnamn varefter det här tillägget måste etableras.
|
publisher
|
string
|
Namnet på tilläggshanterarens utgivare.
|
settings
|
object
|
JSON-formaterade offentliga inställningar för tillägget.
|
type
|
string
|
Typ av tillägg.
|
typeHandlerVersion
|
string
|
Versionen av skripthanteraren.
|
WindowsConfiguration
Inställningar för Windows-operativsystem som ska tillämpas på den virtuella datorn.
Name |
Typ |
Description |
enableAutomaticUpdates
|
boolean
|
Om automatiska uppdateringar är aktiverade på den virtuella datorn.
Om det utelämnas är standardvärdet sant.
|
WindowsUserConfiguration
Egenskaper som används för att skapa ett användarkonto på en Windows-nod.
Name |
Typ |
Description |
loginMode
|
LoginMode
|
Inloggningsläge för användare
Anger inloggningsläge för användaren. Standardvärdet för VirtualMachineConfiguration-pooler är interaktivt läge och för CloudServiceConfiguration-pooler är batchläge.
|