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-07-01
URI-parametrar
Name |
I |
Obligatorisk |
Typ |
Description |
accountName
|
path |
True
|
string
|
Namnet på Batch-kontot.
Reguljärt uttrycksmönster: ^[a-zA-Z0-9]+$
|
poolName
|
path |
True
|
string
|
Poolnamnet. Detta måste vara unikt i kontot.
Reguljärt uttrycksmönster: ^[a-zA-Z0-9_-]+$
|
resourceGroupName
|
path |
True
|
string
|
Namnet på resursgruppen som innehåller Batch-kontot.
|
subscriptionId
|
path |
True
|
string
|
Azure-prenumerations-ID:t. Det här är en GUID-formaterad sträng (t.ex. 00000000-0000-0000-0000-00000000000)
|
api-version
|
query |
True
|
string
|
DEN API-version som ska användas med HTTP-begäran.
|
Name |
Obligatorisk |
Typ |
Description |
If-Match
|
|
string
|
Den entitetstillståndsversion (ETag) av poolen som ska uppdateras. Värdet "*" kan endast användas för att tillämpa åtgärden om poolen redan finns. Om den utelämnas tillämpas alltid den här åtgärden.
|
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 i 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 omskapas. 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/{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.deploymentConfiguration
|
DeploymentConfiguration
|
Den här egenskapen beskriver de virtuella datorer som poolnoderna ska distribueras på.
|
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å 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 som standard inaktiverat.
|
properties.metadata
|
MetadataItem[]
|
En lista över namn/värde-par som är associerade med poolen som metadata.
Batch-tjänsten tilldelar ingen betydelse för 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 taggarna 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 ä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 skalning 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 är standardvärdet utspritt.
|
properties.taskSlotsPerNode
|
integer
|
Antalet aktivitetsfack som kan användas för att köra samtidiga uppgifter 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 VM-storlekar finns i Storlekar för virtuella datorer i Azure (https://learn.microsoft.com/azure/virtual-machines/sizes/overview). Batch har stöd för alla storlekar på virtuella Azure-datorer förutom STANDARD_A0 och de med premiumlagring (STANDARD_GS, STANDARD_DS och STANDARD_DSV2-serien).
|
tags
|
object
|
Taggarna för resursen.
|
Svar
Name |
Typ |
Description |
200 OK
|
Pool
|
Åtgärden lyckades. Svaret innehåller poolentiteten.
Sidhuvuden
ETag: string
|
Other Status Codes
|
CloudError
|
Felsvar som beskriver varför åtgärden misslyckades.
|
Säkerhet
azure_auth
Autentiseringskodflöde för Microsoft Entra OAuth 2.0
Typ:
oauth2
Flow:
implicit
Auktoriseringswebbadress:
https://login.microsoftonline.com/common/oauth2/authorize
Omfattningar
Name |
Description |
user_impersonation
|
personifiera ditt användarkonto
|
Exempel
CreatePool - accelerated networking
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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
}
}
}
}
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.NetworkConfiguration;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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"
}
}
}
}
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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
Exempelsvar
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 VirtualMachineConfiguration
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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"
}
}
}
}
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.CachingType;
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.ImageReference;
import com.azure.resourcemanager.batch.models.InboundEndpointProtocol;
import com.azure.resourcemanager.batch.models.InboundNatPool;
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.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.ScaleSettings;
import com.azure.resourcemanager.batch.models.StorageAccountType;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.batch.models.WindowsConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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,
OSDisk = new BatchOSDisk()
{
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
Exempelsvar
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 VirtualMachineConfiguration
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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"
}
}
}
}
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import java.time.Duration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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"
}
}
}
}
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.IpAddressProvisioningType;
import com.azure.resourcemanager.batch.models.NetworkConfiguration;
import com.azure.resourcemanager.batch.models.PublicIpAddressConfiguration;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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"
}
}
}
}
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.IpAddressProvisioningType;
import com.azure.resourcemanager.batch.models.NetworkConfiguration;
import com.azure.resourcemanager.batch.models.PublicIpAddressConfiguration;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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
Exempelsvar
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
}
}
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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
}
}
}
}
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_ResourceTags.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_d4s_v3",
DeploymentVmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "18_04-lts-gen2",
Version = "latest",
}, "batch.node.ubuntu 18.04"),
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 1,
TargetLowPriorityNodes = 0,
},
},
ResourceTags =
{
["TagName1"] = "TagValue1",
["TagName2"] = "TagValue2",
},
};
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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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
}
}
}
}
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
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.UefiSettings;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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(armbatch.SecurityTypesTrustedLaunch),
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(armbatch.SecurityTypesTrustedLaunch),
// 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-07-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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_SecurityProfile.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_d4s_v3",
DeploymentVmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "18_04-lts-gen2",
Version = "latest",
}, "batch.node.ubuntu 18.04")
{
SecurityProfile = new BatchSecurityProfile()
{
SecurityType = BatchSecurityType.TrustedLaunch,
EncryptionAtHost = true,
UefiSettings = new BatchUefiSettings()
{
IsSecureBootEnabled = null,
IsVTpmEnabled = false,
},
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 1,
TargetLowPriorityNodes = 0,
},
},
};
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
Exempelsvar
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
}
}
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-01
{
"tags": {
"TagName1": "TagValue1",
"TagName2": "TagValue2"
},
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 22.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-01/examples/PoolCreate_Tags.json
*/
/**
* Sample code: CreatePool - Tags.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolTags(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withTags(mapOf("TagName1", "TagValue1", "TagName2", "TagValue2")).withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("0001-com-ubuntu-server-jammy").withSku("22_04-lts").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 22.04")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.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
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_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": "0001-com-ubuntu-server-jammy",
"publisher": "Canonical",
"sku": "22_04-lts",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 22.04",
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d4s_v3",
},
"tags": {"TagName1": "TagValue1", "TagName2": "TagValue2"},
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_Tags.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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_Tags.json
func ExamplePoolClient_Create_createPoolTags() {
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{
Tags: map[string]*string{
"TagName1": to.Ptr("TagValue1"),
"TagName2": to.Ptr("TagValue2"),
},
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("0001-com-ubuntu-server-jammy"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("22_04-lts"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 22.04"),
},
},
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"),
// Tags: map[string]*string{
// "TagName1": to.Ptr("TagValue1"),
// "TagName2": to.Ptr("TagValue2"),
// },
// 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("0001-com-ubuntu-server-jammy"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("22_04-lts"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 22.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),
// },
// 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-07-01/examples/PoolCreate_Tags.json
*/
async function createPoolTags() {
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-jammy",
publisher: "Canonical",
sku: "22_04-lts",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 22.04",
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
tags: { tagName1: "TagValue1", tagName2: "TagValue2" },
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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_Tags.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_d4s_v3",
DeploymentVmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-jammy",
Sku = "22_04-lts",
Version = "latest",
}, "batch.node.ubuntu 22.04"),
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 1,
TargetLowPriorityNodes = 0,
},
},
Tags =
{
["TagName1"] = "TagValue1",
["TagName2"] = "TagValue2",
},
};
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
Exempelsvar
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": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 22.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
},
"tags": {
"TagName1": "TagValue1",
"TagName2": "TagValue2"
}
}
CreatePool - UpgradePolicy
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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
}
}
}
}
import com.azure.resourcemanager.batch.models.AutomaticOSUpgradePolicy;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.NodePlacementConfiguration;
import com.azure.resourcemanager.batch.models.NodePlacementPolicyType;
import com.azure.resourcemanager.batch.models.RollingUpgradePolicy;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.UpgradeMode;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.batch.models.WindowsConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_UpgradePolicy.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_d4s_v3",
DeploymentVmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "MicrosoftWindowsServer",
Offer = "WindowsServer",
Sku = "2019-datacenter-smalldisk",
Version = "latest",
}, "batch.node.windows amd64")
{
IsAutomaticUpdateEnabled = false,
NodePlacementPolicy = BatchNodePlacementPolicyType.Zonal,
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 2,
TargetLowPriorityNodes = 0,
},
},
UpgradePolicy = new UpgradePolicy(UpgradeMode.Automatic)
{
AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy()
{
DisableAutomaticRollback = true,
EnableAutomaticOSUpgrade = true,
UseRollingUpgradePolicy = true,
OSRollingUpgradeDeferral = true,
},
RollingUpgradePolicy = new RollingUpgradePolicy()
{
EnableCrossZoneUpgrade = true,
MaxBatchInstancePercent = 20,
MaxUnhealthyInstancePercent = 20,
MaxUnhealthyUpgradedInstancePercent = 20,
PauseTimeBetweenBatches = "PT0S",
PrioritizeUnhealthyInstances = false,
RollbackFailedInstancesOnPolicyBreach = false,
},
},
};
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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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": {}
}
}
}
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.BatchPoolIdentity;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.PoolIdentityType;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.UserAssignedIdentities;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import java.time.Duration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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"
}
}
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.NodeCommunicationMode;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.VMExtension;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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 Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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",
DeploymentVmConfiguration = 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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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
}
}
}
}
import com.azure.resourcemanager.batch.models.CachingType;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.ManagedDisk;
import com.azure.resourcemanager.batch.models.OSDisk;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.StorageAccountType;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.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_d2s_v3",
DeploymentVmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "microsoftwindowsserver",
Offer = "windowsserver",
Sku = "2022-datacenter-smalldisk",
}, "batch.node.windows amd64")
{
OSDisk = new BatchOSDisk()
{
Caching = BatchDiskCachingType.ReadWrite,
ManagedDisk = new ManagedDisk()
{
StorageAccountType = BatchStorageAccountType.StandardSsdLrs,
},
DiskSizeGB = 100,
IsWriteAcceleratorEnabled = false,
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 1,
TargetLowPriorityNodes = 0,
},
},
};
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
Exempelsvar
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
Exempelbegäran
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-07-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
}
}
}
}
import com.azure.resourcemanager.batch.models.AutomaticOSUpgradePolicy;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.ServiceArtifactReference;
import com.azure.resourcemanager.batch.models.UpgradeMode;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.batch.models.WindowsConfiguration;
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-07-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();
}
// 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
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-07-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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e79d9ef3e065f2dcb6bd1db51e29c62a99dff5cb/specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-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-07-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
using Azure;
using Azure.ResourceManager;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Batch;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-07-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.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_d4s_v3",
DeploymentVmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "MicrosoftWindowsServer",
Offer = "WindowsServer",
Sku = "2019-datacenter-smalldisk",
Version = "latest",
}, "batch.node.windows amd64")
{
IsAutomaticUpdateEnabled = false,
ServiceArtifactReferenceId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 2,
TargetLowPriorityNodes = 0,
},
},
UpgradePolicy = new UpgradePolicy(UpgradeMode.Automatic)
{
AutomaticOSUpgradePolicy = new AutomaticOSUpgradePolicy()
{
EnableAutomaticOSUpgrade = 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
Exempelsvar
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 autoskalningsformel för pooler.
|
AutoScaleRunError
|
Ett fel 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
|
Typ 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.
|
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 Batch-poolen som en beräkningsnod ska använda.
|
ContainerConfiguration
|
Konfigurationen för containeraktiverade pooler.
|
ContainerHostBatchBindMountEntry
|
Posten för sökvägen och monteringsläget som du vill montera i aktivitetscontainern.
|
ContainerHostDataPath
|
Sökvägarna som ska monteras på containeraktivitetens container.
|
ContainerRegistry
|
Ett privat containerregister.
|
ContainerType
|
Den containerteknik 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 frå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 Linux-pool som skapats med Virtual Machine Image eller Azure Compute Gallery Image.
|
DiskEncryptionTarget
|
Listan över diskmål som 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
|
Inställningar för fast skalning 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
|
Slutpunktens protokoll.
|
InboundNatPool
|
En inkommande NAT-pool som kan användas för att hantera 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, undernätsintervall eller 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
|
Nodplaceringskonfiguration 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 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
|
SecurityEncryptionTypes
|
Anger EncryptionType för den hanterade disken. Den är inställd på VMGuestStateOnly för kryptering av bara VMGuestState-bloben och NonPersistedTPM för att inte bevara tillståndet för inbyggd programvara i VMGuestState-bloben.
Obs: Det kan endast anges för konfidentiella virtuella datorer och krävs när du använder konfidentiella virtuella datorer.
|
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
|
Lagringskontotypen som ska användas för att skapa 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 är:
Manuell – Du styr programmet för 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 användaridentiteten under vilken uppgiften körs.
|
VirtualMachineConfiguration
|
Konfigurationen för beräkningsnoder i en pool baserat på Azure Virtual Machines-infrastrukturen.
|
VMDiskSecurityProfile
|
Anger säkerhetsprofilinställningarna för den hanterade disken.
Obs: Det kan bara anges för konfidentiella virtuella datorer och krävs när du använder konfidentiella virtuella datorer.
|
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:t 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 os-avbildning ska inaktiveras.
|
enableAutomaticOSUpgrade
|
boolean
|
Anger om OS-uppgraderingar automatiskt ska tillämpas på skalningsuppsättningsinstanser på ett löpande sätt när en nyare version av OS-avbildningen blir tillgänglig.
Om detta är inställt på sant för Windows-baserade pooler kan WindowsConfiguration.enableAutomaticUpdates inte 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 operativsystemuppgradering. Automatisk os-uppgradering återgår till standardprincipen om ingen princip har definierats på VMSS.
|
AutoScaleRun
Resultatet och felen från en körning av en autoskalningsformel för pooler.
Name |
Typ |
Description |
error
|
AutoScaleRunError
|
Information om felet vid utvärdering av autoskalningsformeln i poolen, om utvärderingen misslyckades.
|
evaluationTime
|
string
|
Den tid 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=value, och variabler avgränsas med semikolon.
|
AutoScaleRunError
Ett fel 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 då poolstorleken ska justeras automatiskt 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 uppgifter, eller om certifikat har angetts i poolen som inte ska vara tillgängliga för normala uppgifter men bör vara tillgängliga genom 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 "monteringsalternativ" i Linux.
|
containerName
|
string
|
Namnet på Azure Blob Storage-containern.
|
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 formuläret "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 "monteringsalternativ" 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
|
<string,
UserAssignedIdentities>
|
Listan över användaridentiteter som är associerade med Batch-poolen.
|
CachingType
Typ 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 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-beräkningsnoder. 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/{user-name}/certs) och certifikat placeras i den 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-beräkningsnoder. 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 användarkontona 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 AutoUser-omfå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 användarkontona under vilka jobbuppgifter 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 "monteringsalternativ" 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.
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.
|
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 kan slutföras 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 kommer att slutföras 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) ska 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 Batch-poolen 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
|
Den containerteknik som ska användas.
|
ContainerHostBatchBindMountEntry
Posten för sökvägen och monteringsläget som du vill montera i aktivitetscontainern.
Name |
Typ |
Description |
isReadOnly
|
boolean
|
Montera den här källsökvägen som skrivskyddat läge eller inte. Standardvärdet är falskt (läs-/skrivläge).
För Linux, om du monterar den här sökvägen som ett läs-/skrivläge betyder det inte att alla användare i containern har läs-/skrivåtkomst för sökvägen, det beror på åtkomsten i den virtuella värddatorn. Om den här sökvägen är skrivskyddad kan inte alla användare i containern ändra sökvägen.
|
source
|
ContainerHostDataPath
|
Sökvägen som monteras på containerkund kan välja.
|
ContainerHostDataPath
Sökvägarna som ska monteras på containeraktivitetens container.
Name |
Typ |
Description |
Applications
|
string
|
Programsökvägen.
|
JobPrep
|
string
|
Jobbförberedelseaktivitetssökvägen.
|
Shared
|
string
|
Sökvägen för uppgift för flera instanser att dela sina filer.
|
Startup
|
string
|
Sökvägen för startaktiviteten.
|
Task
|
string
|
Aktivitetssökvägen.
|
VfsMounts
|
string
|
Sökvägen innehåller alla virtuella filsystem som är monterade på den här noden.
|
ContainerRegistry
Ett privat containerregister.
Name |
Typ |
Description |
identityReference
|
ComputeNodeIdentityReference
|
Referensen till den användartilldelade identitet som ska användas för att komma åt ett Azure Container Registry i stället för användarnamn och lösenord.
Referensen till en användartilldelad identitet som är associerad med Batch-poolen 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
Den containerteknik 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 standardarbetskatalogen för Batch-tjänsten, 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 frå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 cachelagringsalternativen 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 ett 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 premium lokalt redundant lagring.
|
DeploymentConfiguration
Egenskaper för distributionskonfiguration.
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 Linux-pool som skapats med Virtual Machine Image eller Azure Compute Gallery Image.
Name |
Typ |
Description |
targets
|
DiskEncryptionTarget[]
|
Listan över diskmål som 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 som 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ändig administratörsbehörighet.
|
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
Inställningar för fast skalning 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. Tidsgränsvärden använder ISO 8601-format. Använd till exempel PT10M i 10 minuter. Minimivä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:et 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 |
communityGalleryImageId
|
string
|
Unik identifierare för communitygalleribilden
Den här egenskapen är ömsesidigt uteslutande med andra egenskaper och kan hämtas från community gallery image GET-anrop.
|
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 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 Image 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 i https://learn.microsoft.com/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration.
|
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.
|
sharedGalleryImageId
|
string
|
Unik identifierare för den delade galleribilden
Den här egenskapen är ömsesidigt uteslutande med andra egenskaper och kan hämtas från get-anropet för den delade galleribilden.
|
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 bild. Om det utelämnas är standardvärdet "senaste".
|
InboundEndpointProtocol
Slutpunktens protokoll.
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 hantera 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 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 varierar mellan 1 och 65534 förutom portar från 50000 till 55000 som reserveras 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 anges 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 varierar mellan 1 och 65534 förutom 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 anges 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 siffra, måste sluta med en bokstav, ett tal eller 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 har angetts skapas en standardregel för att tillåta 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
|
Slutpunktens protokoll.
|
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 du genom att placera nyckelparet i användarens .ssh-katalog. Om det inte 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 detta är fallet för ett program som används i din uppgift rekommenderas det här alternativet.
|
ManagedDisk
Name |
Typ |
Description |
securityProfile
|
VMDiskSecurityProfile
|
Anger säkerhetsprofilen för den hanterade disken.
Anger säkerhetsprofilinställningarna för den hanterade disken.
Obs: Det kan bara anges för konfidentiella virtuella datorer och krävs när du använder konfidentiella virtuella datorer.
|
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
|
Den Azure-filresurs 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.
|
publicIPAddressConfiguration
|
PublicIPAddressConfiguration
|
|
Den offentliga IPAddress-konfigurationen för beräkningsnoder i Batch-poolen.
Den offentliga IP-adresskonfigurationen för nätverkskonfigurationen för en pool.
|
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 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 åtkomstkontroll (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 uppgifter 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 tillståndet för beräkningsnoderna till oanvändbar. Om det angivna virtuella nätverket har några associerade nätverkssäkerhetsgrupper (NSG) måste några reserverade systemportar aktiveras för inkommande kommunikation, inklusive portarna 29876 och 29877. Aktivera även utgående anslutningar till Azure Storage på port 443. Mer information finns i: https://learn.microsoft.com/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, undernätsintervall eller tagg.
|
priority
|
integer
|
Prioriteten för den här regeln.
Prioriteringar 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 ligga 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, undernätsintervall eller 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 "monteringsalternativ" 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
Nodplaceringskonfiguration 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 standardlagring. 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 i 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 omskapas. Det finns högst 10 programpaketreferenser i en viss pool.
|
properties.autoScaleRun
|
AutoScaleRun
|
|
Resultatet och felen från den senaste körningen av autoskalningsformeln.
Den här egenskapen anges endast om poolen skalar automatiskt, dvs. 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 synlighet för "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 de virtuella datorer som poolnoderna ska distribueras på.
|
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å 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 som standard inaktiverat.
|
properties.lastModified
|
string
|
|
Den senaste ändrade tiden för poolen.
Det här är 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 betydelse för 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.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 taggarna 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 ä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 skalning 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 är standardvärdet utspritt.
|
properties.taskSlotsPerNode
|
integer
|
1
|
Antalet aktivitetsfack som kan användas för att köra samtidiga uppgifter 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 VM-storlekar finns i Storlekar för virtuella datorer i Azure (https://learn.microsoft.com/azure/virtual-machines/sizes/overview). Batch har stöd för alla storlekar på virtuella Azure-datorer förutom STANDARD_A0 och de med premiumlagring (STANDARD_GS, STANDARD_DS och STANDARD_DSV2-serien).
|
tags
|
object
|
|
Taggarna för resursen.
|
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 anger 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 att köra 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 på poolen – 100 dedikerade noder eller 100 noder med oanvänd kapacitet/låg prioritet kan allokeras för varje offentlig IP-adress. En pool som behöver 250 dedikerade virtuella datorer skulle till exempel behöva minst 3 offentliga IP-adresser angivna. Varje element i den här samlingen är av formuläret : /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 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 du utförde den senaste storleksändringen i poolen.
Den här egenskapen anges endast om ett fel uppstod under den senaste poolens storleksändring och endast när poolallokeringenState är Stabil.
|
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. Minimivä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
|
Tiden då den här storleksändringsåtgärden 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 blobar 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 filer som laddas ned till Linux-beräkningsnoder. Den ignoreras om den har angetts 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 har angetts 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 ur 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 blobben, använda en hanterad identitet med läsbehörighet eller ange ACL för blobben eller dess container för att tillåta offentlig åtkomst.
|
identityReference
|
ComputeNodeIdentityReference
|
Referensen till den användartilldelade identitet som ska användas för åtkomst till Azure Blob Storage som anges av storageContainerUrl eller httpUrl
Referensen till en användartilldelad identitet som är associerad med Batch-poolen 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 för att tillåta 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 kommer Azure Azure Batch inte att ange sitt standardvärde. Värdet för enableCrossZoneUpgrade på den skapade VirtualMachineScaleSet bestäms av standardkonfigurationerna på VirtualMachineScaleSet. Det här fältet kan endast anges till sant eller falskt när nodePlacementConfiguration används som zonindelning.
|
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 tilldelas med värde 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 till följd av uppgraderingen 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 tilldelas med värde 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 sker 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 starta nästa batch. Varaktigheten ska 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 för 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
|
Inställningar för fast skalning för poolen.
Den här egenskapen och autoskalan är ömsesidigt uteslutande och en av egenskaperna måste anges.
|
SecurityEncryptionTypes
Anger EncryptionType för den hanterade disken. Den är inställd på VMGuestStateOnly för kryptering av bara VMGuestState-bloben och NonPersistedTPM för att inte bevara tillståndet för inbyggd programvara i VMGuestState-bloben.
Obs: Det kan endast anges för konfidentiella virtuella datorer och krävs när du använder konfidentiella virtuella datorer.
Name |
Typ |
Description |
NonPersistedTPM
|
string
|
|
VMGuestStateOnly
|
string
|
|
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 krypteringen för alla diskar, inklusive resurs/temp-disk 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 |
confidentialVM
|
string
|
Konfidentiell databehandling i Azure erbjuder konfidentiella virtuella datorer för klienter med höga krav på säkerhet och konfidentialitet. Dessa virtuella datorer tillhandahåller en stark, maskinvarubaserad gräns som hjälper dig att uppfylla dina säkerhetsbehov. Du kan använda konfidentiella virtuella datorer för migreringar utan att göra ändringar i koden, där plattformen skyddar den virtuella datorns tillstånd från att läsas eller ändras.
|
trustedLaunch
|
string
|
Betrodd start skyddar mot avancerade och beständiga attacktekniker.
|
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 några andra egenskaper för startTask anges.
|
containerSettings
|
TaskContainerSettings
|
|
Inställningarna för containern under vilken startaktiviteten körs.
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 provar uppgiften en gång och kan sedan försöka upp till den här gränsen igen. 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 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. avsluta 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 maximalt antal å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 schemaläggningsfelinformationen. 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
Lagringskontotypen som ska användas för att skapa datadiskar eller OS-diskar.
Name |
Typ |
Description |
Premium_LRS
|
string
|
Datadisken/OS-disken bör använda premium lokalt redundant lagring.
|
StandardSSD_LRS
|
string
|
Datadisken/OS-disken ska använda standardlagring med lokalt redundant SSD.
|
Standard_LRS
|
string
|
Datadisken/OS-disken bör använda lokalt redundant standardlagring.
|
TaskContainerSettings
Containerinställningarna för en uppgift.
Name |
Typ |
Description |
containerHostBatchBindMounts
|
ContainerHostBatchBindMountEntry[]
|
Sökvägarna som du vill montera på containeraktiviteten.
Om den här matrisen är null eller inte finns monterar containeraktiviteten hela den tillfälliga diskenheten i Windows (eller AZ_BATCH_NODE_ROOT_DIR i Linux). Den monterar inga datasökvägar i containern om den här matrisen har angetts som tom.
|
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 är:
Manuell – Du styr programmet för 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 up-to-date.
|
UpgradePolicy
Beskriver en uppgraderingsprincip – automatisk, manuell eller rullande.
Name |
Typ |
Description |
automaticOSUpgradePolicy
|
AutomaticOSUpgradePolicy
|
Konfigurationsparametrar som används för att utföra automatisk operativsystemuppgradering.
De konfigurationsparametrar som används för att utföra automatisk operativsystemuppgradering.
|
mode
|
UpgradeMode
|
Anger läget för en uppgradering till virtuella datorer i skalningsuppsättningen.
Möjliga värden är:
Manuell – Du styr programmet för 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.
|
rollingUpgradePolicy
|
RollingUpgradePolicy
|
De konfigurationsparametrar som används vid löpande uppgradering.
De konfigurationsparametrar som används vid löpande uppgradering.
|
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 det inte 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 användaridentiteten under vilken uppgiften körs.
Name |
Typ |
Description |
autoUser
|
AutoUserSpecification
|
Den automatiska användare under vilken aktiviteten 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-avbildningen 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 det 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 bildreferensen. 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.
|
VMDiskSecurityProfile
Anger säkerhetsprofilinställningarna för den hanterade disken.
Obs: Det kan bara anges för konfidentiella virtuella datorer och krävs när du använder konfidentiella virtuella datorer.
Name |
Typ |
Description |
securityEncryptionType
|
SecurityEncryptionTypes
|
Anger EncryptionType för den hanterade disken. Den är inställd på VMGuestStateOnly för kryptering av bara VMGuestState-bloben och NonPersistedTPM för att inte bevara tillståndet för inbyggd programvara i VMGuestState-bloben.
Obs: Det kan endast anges för konfidentiella virtuella datorer och krävs när du använder konfidentiella virtuella datorer.
|
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 mindre versioner 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 tillgängligt.
|
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 tilläggsnamn varefter 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 är Interaktivt.
|