Létrehoz egy új készletet a megadott fiókon belül.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}/pools/{poolName}?api-version=2024-02-01
URI-paraméterek
Name |
In |
Kötelező |
Típus |
Description |
accountName
|
path |
True
|
string
|
A Batch-fiók neve.
Regex pattern: ^[a-zA-Z0-9]+$
|
poolName
|
path |
True
|
string
|
A készlet neve. Ennek egyedinek kell lennie a fiókon belül.
Regex pattern: ^[a-zA-Z0-9_-]+$
|
resourceGroupName
|
path |
True
|
string
|
A Batch-fiókot tartalmazó erőforráscsoport neve.
|
subscriptionId
|
path |
True
|
string
|
Az Azure-előfizetés azonosítója. Ez egy GUID formátumú sztring (pl. 00000000-0000-0000-0000-0000000000000)
|
api-version
|
query |
True
|
string
|
A HTTP-kéréshez használandó API-verzió.
|
Name |
Kötelező |
Típus |
Description |
If-Match
|
|
string
|
A frissítendő készlet entitásállapotának (ETag) verziója. A "*" érték csak akkor alkalmazható a műveletre, ha a készlet már létezik. Ha nincs megadva, a rendszer mindig alkalmazza ezt a műveletet.
|
If-None-Match
|
|
string
|
Állítsa a "*" értéket egy új készlet létrehozásának engedélyezéséhez, de a meglévő készlet frissítésének megakadályozásához. A rendszer figyelmen kívül hagyja az egyéb értékeket.
|
Kérelem törzse
Name |
Típus |
Description |
identity
|
BatchPoolIdentity
|
A Batch-készlethez használt identitás típusa.
A Batch-készlethez használt identitás típusa.
|
properties.applicationLicenses
|
string[]
|
A Batch szolgáltatás által elérhetővé tenni kívánt alkalmazáslicencek listája a készlet minden számítási csomópontján.
Az alkalmazáslicencek listájának az elérhető Batch-szolgáltatásalkalmazás-licencek egy részhalmazának kell lennie. Ha olyan licencet kérnek, amely nem támogatott, a készlet létrehozása sikertelen lesz.
|
properties.applicationPackages
|
ApplicationPackageReference[]
|
A készlet minden számítási csomópontjára telepíteni kívánt alkalmazáscsomagok listája.
Az alkalmazáscsomag-hivatkozások módosítása hatással van a készlethez csatlakozó összes új számítási csomópontra, de nem érinti azokat a számítási csomópontokat, amelyek már a készletben vannak, amíg újra nem indítják vagy újra nem alakítják őket. Egy adott készleten legfeljebb 10 alkalmazáscsomag-hivatkozás található.
|
properties.certificates
|
CertificateReference[]
|
A készlet minden számítási csomópontjára telepíteni kívánt tanúsítványok listája.
Windows számítási csomópontok esetén a Batch szolgáltatás telepíti a tanúsítványokat a megadott tanúsítványtárolóba és helyre. Linux számítási csomópontok esetén a tanúsítványok a feladat munkakönyvtárában található könyvtárban vannak tárolva, és a rendszer egy környezeti változót AZ_BATCH_CERTIFICATES_DIR a feladatnak, amely lekérdezi ezt a helyet. A "remoteUser" láthatóságú tanúsítványok esetében a rendszer létrehoz egy "certs" könyvtárat a felhasználó kezdőkönyvtárában (pl. /home/{user-name}/certs), és a tanúsítványok ebben a könyvtárban vannak elhelyezve.
Figyelmeztetés: Ez a tulajdonság elavult, és 2024 februárja után törlődik. Használja inkább az Azure KeyVault bővítményt .
|
properties.deploymentConfiguration
|
DeploymentConfiguration
|
Ez a tulajdonság a készletcsomópontok üzembe helyezésének módját ismerteti Cloud Services vagy Virtual Machines használatával.
A CloudServiceConfiguration használatával megadhatja, hogy a csomópontokat az Azure Cloud Services (PaaS) használatával kell létrehozni, míg a VirtualMachineConfiguration az Azure Virtual Machines (IaaS) szolgáltatást használja.
|
properties.displayName
|
string
|
A készlet megjelenítendő neve.
A megjelenítendő névnek nem kell egyedinek lennie, és legfeljebb 1024 hosszúságú Unicode-karaktereket tartalmazhat.
|
properties.interNodeCommunication
|
InterNodeCommunicationState
|
Azt jelzi, hogy a készlet engedélyezi-e a csomópontok közötti közvetlen kommunikációt.
Ez korlátozza, hogy mely csomópontok rendelhetők hozzá a készlethez. Ennek az értéknek az engedélyezése csökkentheti a készletben lefoglalandó csomópontok kért számának esélyét. Ha nincs megadva, ez az érték alapértelmezés szerint "Letiltva".
|
properties.metadata
|
MetadataItem[]
|
A készlethez metaadatként társított név-érték párok listája.
A Batch szolgáltatás nem rendel semmilyen jelentést a metaadatokhoz; kizárólag felhasználói kód használatára szolgál.
|
properties.mountConfiguration
|
MountConfiguration[]
|
A készlet minden csomópontjára csatlakoztatni kívánt fájlrendszerek listája.
Ez támogatja a Azure Files, az NFS, a CIFS/SMB és a Blobfuse használatát.
|
properties.networkConfiguration
|
NetworkConfiguration
|
A készlet hálózati konfigurációja.
A készlet hálózati konfigurációja.
|
properties.resourceTags
|
object
|
A készlethez társított felhasználó által megadott címkék.
A Azure Batch készlethez társítandó felhasználó által definiált címkék. Ha meg van adva, a rendszer propagálja ezeket a címkéket a készlethez társított háttérbeli Azure-erőforrásokba. Ez a tulajdonság csak akkor adható meg, ha a Batch-fiók létrejött, és a poolAllocationMode tulajdonság értéke "UserSubscription".
|
properties.scaleSettings
|
ScaleSettings
|
A készletben lévő csomópontok számát konfiguráló beállítások.
Meghatározza a készlet kívánt méretét. Ez lehet "rögzített skálázás", ha meg van adva a kért targetDedicatedNodes, vagy az "automatikus skálázás", amely egy rendszeresen újraértékelt képletet definiál. Ha ez a tulajdonság nincs megadva, a készlet rögzített skálával fog rendelkezni 0 targetDedicatedNodes értékekkel.
|
properties.startTask
|
StartTask
|
Az egyes számítási csomópontokon a készlethez való csatlakozáskor futtatandó feladat.
A PATCH (frissítési) műveletben ez a tulajdonság egy üres objektumra állítható be, hogy eltávolítsa a kezdő tevékenységet a készletből.
|
properties.targetNodeCommunicationMode
|
NodeCommunicationMode
|
A készlet kívánt csomópontkommunikációs módja.
Ha nincs megadva, az alapértelmezett érték az Alapértelmezett.
|
properties.taskSchedulingPolicy
|
TaskSchedulingPolicy
|
A tevékenységek elosztása a készlet számítási csomópontjai között.
Ha nincs megadva, az alapértelmezett oldalpár.
|
properties.taskSlotsPerNode
|
integer
|
A készlet egyetlen számítási csomópontján egyidejű feladatok futtatására használható feladathelyek száma.
Az alapértelmezett érték az 1. A maximális érték a készlet vmSize magjainak számának négyszerese vagy 256.
|
properties.upgradePolicy
|
UpgradePolicy
|
A készlet frissítési szabályzata.
Egy frissítési szabályzatot ír le – automatikus, manuális vagy működés közben.
|
properties.userAccounts
|
UserAccount[]
|
A készlet minden csomópontján létrehozandó felhasználói fiókok listája.
|
properties.vmSize
|
string
|
A készletben lévő virtuális gépek mérete. A készlet összes virtuális gépe azonos méretű.
A Cloud Services készletekhez (a cloudServiceConfiguration használatával létrehozott készletekhez) elérhető virtuális gépek méretével kapcsolatos információkért lásd: Cloud Services méretei (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). A Batch az ExtraSmall kivételével minden Cloud Services virtuálisgép-méretet támogatja. A Virtual Machines Marketplace-en (virtualMachineConfiguration használatával létrehozott készletek) rendszerképeket használó készletek rendelkezésre álló virtuálisgép-méreteivel kapcsolatos információkért lásd: Virtual Machines méretei (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) vagy Virtual Machines méretei (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). A Batch az összes Azure-beli virtuálisgép-méretet támogatja, kivéve a STANDARD_A0 és a prémium szintű tárolóval (STANDARD_GS, STANDARD_DS és STANDARD_DSV2 sorozattal rendelkezőket).
|
Válaszok
Name |
Típus |
Description |
200 OK
|
Pool
|
A művelet sikeres volt. A válasz tartalmazza a készlet entitását.
Headers
ETag: string
|
Other Status Codes
|
CloudError
|
Hibaválasz, amely leírja, hogy a művelet miért hiúsult meg.
|
Biztonság
azure_auth
Microsoft Entra OAuth 2.0 hitelesítési kódfolyamata
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
felhasználói fiók megszemélyesítése
|
Példák
CreatePool - accelerated networking
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D1_V2",
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"enableAcceleratedNetworking": true
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_accelerated_networking.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2016-datacenter-smalldisk",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.windows amd64",
}
},
"networkConfiguration": {
"enableAcceleratedNetworking": True,
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "STANDARD_D1_V2",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
func ExamplePoolClient_Create_createPoolAcceleratedNetworking() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2016-datacenter-smalldisk"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
EnableAcceleratedNetworking: to.Ptr(true),
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("STANDARD_D1_V2"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB46CB72A227E2\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T03:00:34.064Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](1),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// CurrentNodeCommunicationMode: to.Ptr(armbatch.NodeCommunicationModeClassic),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2016-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// DynamicVNetAssignmentScope: to.Ptr(armbatch.DynamicVNetAssignmentScopeNone),
// EnableAcceleratedNetworking: to.Ptr(true),
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-27T02:59:41.859Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D1_V2"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
*/
async function createPoolAcceleratedNetworking() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2016-datacenter-smalldisk",
version: "latest",
},
nodeAgentSkuId: "batch.node.windows amd64",
},
},
networkConfiguration: {
enableAcceleratedNetworking: true,
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "STANDARD_D1_V2",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D1_V2",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "MicrosoftWindowsServer",
Offer = "WindowsServer",
Sku = "2016-datacenter-smalldisk",
Version = "latest",
}, "batch.node.windows amd64"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 1,
TargetLowPriorityNodes = 0,
},
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
EnableAcceleratedNetworking = true,
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB46CB72A227E2"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB46CB72A227E2\"",
"properties": {
"lastModified": "2023-04-27T02:59:41.8592226Z",
"creationTime": "2023-04-27T02:59:41.8592226Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-04-27T02:59:41.8592226Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2023-04-27T03:00:34.0646502Z",
"vmSize": "STANDARD_D1_V2",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64"
}
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"dynamicVnetAssignmentScope": "none",
"enableAcceleratedNetworking": true
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-04-27T02:59:41.8592226Z"
},
"currentDedicatedNodes": 1,
"currentLowPriorityNodes": 0,
"currentNodeCommunicationMode": "Classic"
}
}
CreatePool - Custom Image
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_shared_image_gallery.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
func ExamplePoolClient_Create_createPoolCustomImage() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// TargetDedicatedNodes: to.Ptr[int32](0),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
*/
async function createPoolCustomImage() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
}, "batch.node.ubuntu 18.04"),
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 0,
"targetLowPriorityNodes": 0
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Full CloudServiceConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"displayName": "my-pool-name",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Enabled",
"taskSlotsPerNode": 13,
"taskSchedulingPolicy": {
"nodeFillType": "Pack"
},
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "4",
"osVersion": "WA-GUEST-OS-4.45_201708-01"
}
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"
]
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 6,
"targetLowPriorityNodes": 28,
"resizeTimeout": "PT8M",
"nodeDeallocationOption": "TaskCompletion"
}
},
"metadata": [
{
"name": "metadata-1",
"value": "value-1"
},
{
"name": "metadata-2",
"value": "value-2"
}
],
"startTask": {
"commandLine": "cmd /c SET",
"resourceFiles": [
{
"httpUrl": "https://testaccount.blob.core.windows.net/example-blob-file",
"filePath": "c:\\temp\\gohere",
"fileMode": "777"
}
],
"environmentSettings": [
{
"name": "MYSET",
"value": "1234"
}
],
"userIdentity": {
"autoUser": {
"scope": "Pool",
"elevationLevel": "Admin"
}
},
"maxTaskRetryCount": 6,
"waitForSuccess": true
},
"userAccounts": [
{
"name": "username1",
"password": "<ExamplePassword>",
"elevationLevel": "Admin",
"linuxUserConfiguration": {
"sshPrivateKey": "sshprivatekeyvalue",
"uid": 1234,
"gid": 4567
}
}
],
"applicationPackages": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
"version": "asdf"
}
],
"certificates": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
"storeLocation": "LocalMachine",
"storeName": "MY",
"visibility": [
"RemoteUser"
]
}
],
"applicationLicenses": [
"app-license0",
"app-license1"
]
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_cloud_service_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"applicationLicenses": ["app-license0", "app-license1"],
"applicationPackages": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
"version": "asdf",
}
],
"certificates": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
"storeLocation": "LocalMachine",
"storeName": "MY",
"visibility": ["RemoteUser"],
}
],
"deploymentConfiguration": {
"cloudServiceConfiguration": {"osFamily": "4", "osVersion": "WA-GUEST-OS-4.45_201708-01"}
},
"displayName": "my-pool-name",
"interNodeCommunication": "Enabled",
"metadata": [{"name": "metadata-1", "value": "value-1"}, {"name": "metadata-2", "value": "value-2"}],
"networkConfiguration": {
"publicIPAddressConfiguration": {
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268",
],
"provision": "UserManaged",
},
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"scaleSettings": {
"fixedScale": {
"nodeDeallocationOption": "TaskCompletion",
"resizeTimeout": "PT8M",
"targetDedicatedNodes": 6,
"targetLowPriorityNodes": 28,
}
},
"startTask": {
"commandLine": "cmd /c SET",
"environmentSettings": [{"name": "MYSET", "value": "1234"}],
"maxTaskRetryCount": 6,
"resourceFiles": [
{
"fileMode": "777",
"filePath": "c:\\temp\\gohere",
"httpUrl": "https://testaccount.blob.core.windows.net/example-blob-file",
}
],
"userIdentity": {"autoUser": {"elevationLevel": "Admin", "scope": "Pool"}},
"waitForSuccess": True,
},
"taskSchedulingPolicy": {"nodeFillType": "Pack"},
"taskSlotsPerNode": 13,
"userAccounts": [
{
"elevationLevel": "Admin",
"linuxUserConfiguration": {"gid": 4567, "sshPrivateKey": "sshprivatekeyvalue", "uid": 1234},
"name": "username1",
"password": "<ExamplePassword>",
}
],
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
func ExamplePoolClient_Create_createPoolFullCloudServiceConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
ApplicationLicenses: []*string{
to.Ptr("app-license0"),
to.Ptr("app-license1")},
ApplicationPackages: []*armbatch.ApplicationPackageReference{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234"),
Version: to.Ptr("asdf"),
}},
Certificates: []*armbatch.CertificateReference{
{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567"),
StoreLocation: to.Ptr(armbatch.CertificateStoreLocationLocalMachine),
StoreName: to.Ptr("MY"),
Visibility: []*armbatch.CertificateVisibility{
to.Ptr(armbatch.CertificateVisibilityRemoteUser)},
}},
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
OSFamily: to.Ptr("4"),
OSVersion: to.Ptr("WA-GUEST-OS-4.45_201708-01"),
},
},
DisplayName: to.Ptr("my-pool-name"),
InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateEnabled),
Metadata: []*armbatch.MetadataItem{
{
Name: to.Ptr("metadata-1"),
Value: to.Ptr("value-1"),
},
{
Name: to.Ptr("metadata-2"),
Value: to.Ptr("value-2"),
}},
NetworkConfiguration: &armbatch.NetworkConfiguration{
PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
IPAddressIDs: []*string{
to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"),
to.Ptr("/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268")},
Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
},
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionTaskCompletion),
ResizeTimeout: to.Ptr("PT8M"),
TargetDedicatedNodes: to.Ptr[int32](6),
TargetLowPriorityNodes: to.Ptr[int32](28),
},
},
StartTask: &armbatch.StartTask{
CommandLine: to.Ptr("cmd /c SET"),
EnvironmentSettings: []*armbatch.EnvironmentSetting{
{
Name: to.Ptr("MYSET"),
Value: to.Ptr("1234"),
}},
MaxTaskRetryCount: to.Ptr[int32](6),
ResourceFiles: []*armbatch.ResourceFile{
{
FileMode: to.Ptr("777"),
FilePath: to.Ptr("c:\\temp\\gohere"),
HTTPURL: to.Ptr("https://testaccount.blob.core.windows.net/example-blob-file"),
}},
UserIdentity: &armbatch.UserIdentity{
AutoUser: &armbatch.AutoUserSpecification{
ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
Scope: to.Ptr(armbatch.AutoUserScopePool),
},
},
WaitForSuccess: to.Ptr(true),
},
TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypePack),
},
TaskSlotsPerNode: to.Ptr[int32](13),
UserAccounts: []*armbatch.UserAccount{
{
Name: to.Ptr("username1"),
ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
LinuxUserConfiguration: &armbatch.LinuxUserConfiguration{
Gid: to.Ptr[int32](4567),
SSHPrivateKey: to.Ptr("sshprivatekeyvalue"),
UID: to.Ptr[int32](1234),
},
Password: to.Ptr("<ExamplePassword>"),
}},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ApplicationLicenses: []*string{
// to.Ptr("app-license0"),
// to.Ptr("app-license1")},
// ApplicationPackages: []*armbatch.ApplicationPackageReference{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234"),
// Version: to.Ptr("asdf"),
// }},
// Certificates: []*armbatch.CertificateReference{
// {
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567"),
// StoreLocation: to.Ptr(armbatch.CertificateStoreLocationLocalMachine),
// StoreName: to.Ptr("MY"),
// Visibility: []*armbatch.CertificateVisibility{
// to.Ptr(armbatch.CertificateVisibilityRemoteUser)},
// }},
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
// OSFamily: to.Ptr("4"),
// OSVersion: to.Ptr("WA-GUEST-OS-4.45_201708-01"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateEnabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// Metadata: []*armbatch.MetadataItem{
// {
// Name: to.Ptr("metadata-1"),
// Value: to.Ptr("value-1"),
// },
// {
// Name: to.Ptr("metadata-2"),
// Value: to.Ptr("value-2"),
// }},
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
// IPAddressIDs: []*string{
// to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"),
// to.Ptr("/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268")},
// Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
// },
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionTaskCompletion),
// ResizeTimeout: to.Ptr("PT8M"),
// TargetDedicatedNodes: to.Ptr[int32](6),
// TargetLowPriorityNodes: to.Ptr[int32](28),
// },
// },
// StartTask: &armbatch.StartTask{
// CommandLine: to.Ptr("cmd /c SET"),
// EnvironmentSettings: []*armbatch.EnvironmentSetting{
// {
// Name: to.Ptr("MYSET"),
// Value: to.Ptr("1234"),
// }},
// MaxTaskRetryCount: to.Ptr[int32](6),
// ResourceFiles: []*armbatch.ResourceFile{
// {
// FileMode: to.Ptr("777"),
// FilePath: to.Ptr("c:\\temp\\gohere"),
// HTTPURL: to.Ptr("https://testaccount.blob.core.windows.net/example-blob-file"),
// }},
// UserIdentity: &armbatch.UserIdentity{
// AutoUser: &armbatch.AutoUserSpecification{
// ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
// Scope: to.Ptr(armbatch.AutoUserScopePool),
// },
// },
// WaitForSuccess: to.Ptr(true),
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypePack),
// },
// TaskSlotsPerNode: to.Ptr[int32](13),
// UserAccounts: []*armbatch.UserAccount{
// {
// Name: to.Ptr("username1"),
// ElevationLevel: to.Ptr(armbatch.ElevationLevelAdmin),
// LinuxUserConfiguration: &armbatch.LinuxUserConfiguration{
// Gid: to.Ptr[int32](4567),
// UID: to.Ptr[int32](1234),
// },
// }},
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
*/
async function createPoolFullCloudServiceConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
applicationLicenses: ["app-license0", "app-license1"],
applicationPackages: [
{
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
version: "asdf",
},
],
certificates: [
{
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
storeLocation: "LocalMachine",
storeName: "MY",
visibility: ["RemoteUser"],
},
],
deploymentConfiguration: {
cloudServiceConfiguration: {
osFamily: "4",
osVersion: "WA-GUEST-OS-4.45_201708-01",
},
},
displayName: "my-pool-name",
interNodeCommunication: "Enabled",
metadata: [
{ name: "metadata-1", value: "value-1" },
{ name: "metadata-2", value: "value-2" },
],
networkConfiguration: {
publicIPAddressConfiguration: {
ipAddressIds: [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268",
],
provision: "UserManaged",
},
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
scaleSettings: {
fixedScale: {
nodeDeallocationOption: "TaskCompletion",
resizeTimeout: "PT8M",
targetDedicatedNodes: 6,
targetLowPriorityNodes: 28,
},
},
startTask: {
commandLine: "cmd /c SET",
environmentSettings: [{ name: "MYSET", value: "1234" }],
maxTaskRetryCount: 6,
resourceFiles: [
{
fileMode: "777",
filePath: "c:\\temp\\gohere",
httpUrl: "https://testaccount.blob.core.windows.net/example-blob-file",
},
],
userIdentity: { autoUser: { elevationLevel: "Admin", scope: "Pool" } },
waitForSuccess: true,
},
taskSchedulingPolicy: { nodeFillType: "Pack" },
taskSlotsPerNode: 13,
userAccounts: [
{
name: "username1",
elevationLevel: "Admin",
linuxUserConfiguration: {
gid: 4567,
sshPrivateKey: "sshprivatekeyvalue",
uid: 1234,
},
password: "<ExamplePassword>",
},
],
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_CloudServiceConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
DisplayName = "my-pool-name",
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
CloudServiceConfiguration = new BatchCloudServiceConfiguration("4")
{
OSVersion = "WA-GUEST-OS-4.45_201708-01",
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
ResizeTimeout = XmlConvert.ToTimeSpan("PT8M"),
TargetDedicatedNodes = 6,
TargetLowPriorityNodes = 28,
NodeDeallocationOption = BatchNodeDeallocationOption.TaskCompletion,
},
},
InterNodeCommunication = InterNodeCommunicationState.Enabled,
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
PublicIPAddressConfiguration = new BatchPublicIPAddressConfiguration()
{
Provision = BatchIPAddressProvisioningType.UserManaged,
IPAddressIds =
{
new ResourceIdentifier("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"),new ResourceIdentifier("/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268")
},
},
},
TaskSlotsPerNode = 13,
TaskSchedulingNodeFillType = BatchNodeFillType.Pack,
UserAccounts =
{
new BatchUserAccount("username1","<ExamplePassword>")
{
ElevationLevel = BatchUserAccountElevationLevel.Admin,
LinuxUserConfiguration = new BatchLinuxUserConfiguration()
{
Uid = 1234,
Gid = 4567,
SshPrivateKey = "sshprivatekeyvalue",
},
}
},
Metadata =
{
new BatchAccountPoolMetadataItem("metadata-1","value-1"),new BatchAccountPoolMetadataItem("metadata-2","value-2")
},
StartTask = new BatchAccountPoolStartTask()
{
CommandLine = "cmd /c SET",
ResourceFiles =
{
new BatchResourceFile()
{
HttpUri = new Uri("https://testaccount.blob.core.windows.net/example-blob-file"),
FilePath = "c:\\temp\\gohere",
FileMode = "777",
}
},
EnvironmentSettings =
{
new BatchEnvironmentSetting("MYSET")
{
Value = "1234",
}
},
UserIdentity = new BatchUserIdentity()
{
AutoUser = new BatchAutoUserSpecification()
{
Scope = BatchAutoUserScope.Pool,
ElevationLevel = BatchUserAccountElevationLevel.Admin,
},
},
MaxTaskRetryCount = 6,
WaitForSuccess = true,
},
Certificates =
{
new BatchCertificateReference(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567"))
{
StoreLocation = BatchCertificateStoreLocation.LocalMachine,
StoreName = "MY",
Visibility =
{
BatchCertificateVisibility.RemoteUser
},
}
},
ApplicationPackages =
{
new BatchApplicationPackageReference(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234"))
{
Version = "asdf",
}
},
ApplicationLicenses =
{
"app-license0","app-license1"
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Enabled",
"taskSlotsPerNode": 13,
"taskSchedulingPolicy": {
"nodeFillType": "Pack"
},
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "4",
"osVersion": "WA-GUEST-OS-4.45_201708-01"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 6,
"targetLowPriorityNodes": 28,
"resizeTimeout": "PT8M",
"nodeDeallocationOption": "TaskCompletion"
}
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"
]
}
},
"metadata": [
{
"name": "metadata-1",
"value": "value-1"
},
{
"name": "metadata-2",
"value": "value-2"
}
],
"startTask": {
"commandLine": "cmd /c SET",
"resourceFiles": [
{
"httpUrl": "https://testaccount.blob.core.windows.net/example-blob-file",
"filePath": "c:\\temp\\gohere",
"fileMode": "777"
}
],
"environmentSettings": [
{
"name": "MYSET",
"value": "1234"
}
],
"userIdentity": {
"autoUser": {
"scope": "Pool",
"elevationLevel": "Admin"
}
},
"maxTaskRetryCount": 6,
"waitForSuccess": true
},
"userAccounts": [
{
"name": "username1",
"elevationLevel": "Admin",
"linuxUserConfiguration": {
"uid": 1234,
"gid": 4567
}
}
],
"applicationPackages": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234",
"version": "asdf"
}
],
"certificates": [
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567",
"storeLocation": "LocalMachine",
"storeName": "MY",
"visibility": [
"RemoteUser"
]
}
],
"applicationLicenses": [
"app-license0",
"app-license1"
],
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Full VirtualMachineConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter-SmallDisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"licenseType": "Windows_Server",
"dataDisks": [
{
"lun": 0,
"caching": "ReadWrite",
"diskSizeGB": 30,
"storageAccountType": "Premium_LRS"
},
{
"lun": 1,
"caching": "None",
"diskSizeGB": 200,
"storageAccountType": "Standard_LRS"
}
],
"diskEncryptionConfiguration": {
"targets": [
"OsDisk",
"TemporaryDisk"
]
},
"nodePlacementConfiguration": {
"policy": "Zonal"
},
"osDisk": {
"ephemeralOSDiskSettings": {
"placement": "CacheDisk"
}
}
}
},
"networkConfiguration": {
"endpointConfiguration": {
"inboundNatPools": [
{
"name": "testnat",
"protocol": "TCP",
"backendPort": 12001,
"frontendPortRangeStart": 15000,
"frontendPortRangeEnd": 15100,
"networkSecurityGroupRules": [
{
"access": "Allow",
"sourceAddressPrefix": "192.100.12.45",
"priority": 150,
"sourcePortRanges": [
"1",
"2"
]
},
{
"access": "Deny",
"sourceAddressPrefix": "*",
"priority": 3500,
"sourcePortRanges": [
"*"
]
}
]
}
]
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"dataDisks": [
{"caching": "ReadWrite", "diskSizeGB": 30, "lun": 0, "storageAccountType": "Premium_LRS"},
{"caching": "None", "diskSizeGB": 200, "lun": 1, "storageAccountType": "Standard_LRS"},
],
"diskEncryptionConfiguration": {"targets": ["OsDisk", "TemporaryDisk"]},
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2016-Datacenter-SmallDisk",
"version": "latest",
},
"licenseType": "Windows_Server",
"nodeAgentSkuId": "batch.node.windows amd64",
"nodePlacementConfiguration": {"policy": "Zonal"},
"osDisk": {"ephemeralOSDiskSettings": {"placement": "CacheDisk"}},
"windowsConfiguration": {"enableAutomaticUpdates": False},
}
},
"networkConfiguration": {
"endpointConfiguration": {
"inboundNatPools": [
{
"backendPort": 12001,
"frontendPortRangeEnd": 15100,
"frontendPortRangeStart": 15000,
"name": "testnat",
"networkSecurityGroupRules": [
{
"access": "Allow",
"priority": 150,
"sourceAddressPrefix": "192.100.12.45",
"sourcePortRanges": ["1", "2"],
},
{
"access": "Deny",
"priority": 3500,
"sourceAddressPrefix": "*",
"sourcePortRanges": ["*"],
},
],
"protocol": "TCP",
}
]
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
func ExamplePoolClient_Create_createPoolFullVirtualMachineConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
DataDisks: []*armbatch.DataDisk{
{
Caching: to.Ptr(armbatch.CachingTypeReadWrite),
DiskSizeGB: to.Ptr[int32](30),
Lun: to.Ptr[int32](0),
StorageAccountType: to.Ptr(armbatch.StorageAccountTypePremiumLRS),
},
{
Caching: to.Ptr(armbatch.CachingTypeNone),
DiskSizeGB: to.Ptr[int32](200),
Lun: to.Ptr[int32](1),
StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardLRS),
}},
DiskEncryptionConfiguration: &armbatch.DiskEncryptionConfiguration{
Targets: []*armbatch.DiskEncryptionTarget{
to.Ptr(armbatch.DiskEncryptionTargetOsDisk),
to.Ptr(armbatch.DiskEncryptionTargetTemporaryDisk)},
},
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2016-Datacenter-SmallDisk"),
Version: to.Ptr("latest"),
},
LicenseType: to.Ptr("Windows_Server"),
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
},
OSDisk: &armbatch.OSDisk{
EphemeralOSDiskSettings: &armbatch.DiffDiskSettings{
Placement: to.Ptr("CacheDisk"),
},
},
WindowsConfiguration: &armbatch.WindowsConfiguration{
EnableAutomaticUpdates: to.Ptr(false),
},
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
EndpointConfiguration: &armbatch.PoolEndpointConfiguration{
InboundNatPools: []*armbatch.InboundNatPool{
{
Name: to.Ptr("testnat"),
BackendPort: to.Ptr[int32](12001),
FrontendPortRangeEnd: to.Ptr[int32](15100),
FrontendPortRangeStart: to.Ptr[int32](15000),
NetworkSecurityGroupRules: []*armbatch.NetworkSecurityGroupRule{
{
Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessAllow),
Priority: to.Ptr[int32](150),
SourceAddressPrefix: to.Ptr("192.100.12.45"),
SourcePortRanges: []*string{
to.Ptr("1"),
to.Ptr("2")},
},
{
Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessDeny),
Priority: to.Ptr[int32](3500),
SourceAddressPrefix: to.Ptr("*"),
SourcePortRanges: []*string{
to.Ptr("*")},
}},
Protocol: to.Ptr(armbatch.InboundEndpointProtocolTCP),
}},
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// DataDisks: []*armbatch.DataDisk{
// {
// Caching: to.Ptr(armbatch.CachingTypeReadWrite),
// DiskSizeGB: to.Ptr[int32](30),
// Lun: to.Ptr[int32](0),
// StorageAccountType: to.Ptr(armbatch.StorageAccountTypePremiumLRS),
// },
// {
// Caching: to.Ptr(armbatch.CachingTypeNone),
// DiskSizeGB: to.Ptr[int32](200),
// Lun: to.Ptr[int32](1),
// StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardLRS),
// }},
// DiskEncryptionConfiguration: &armbatch.DiskEncryptionConfiguration{
// Targets: []*armbatch.DiskEncryptionTarget{
// to.Ptr(armbatch.DiskEncryptionTargetOsDisk),
// to.Ptr(armbatch.DiskEncryptionTargetTemporaryDisk)},
// },
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2016-Datacenter-SmallDisk"),
// Version: to.Ptr("latest"),
// },
// LicenseType: to.Ptr("Windows_Server"),
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
// Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
// },
// WindowsConfiguration: &armbatch.WindowsConfiguration{
// EnableAutomaticUpdates: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// EndpointConfiguration: &armbatch.PoolEndpointConfiguration{
// InboundNatPools: []*armbatch.InboundNatPool{
// {
// Name: to.Ptr("testnat"),
// BackendPort: to.Ptr[int32](12001),
// FrontendPortRangeEnd: to.Ptr[int32](15100),
// FrontendPortRangeStart: to.Ptr[int32](15000),
// NetworkSecurityGroupRules: []*armbatch.NetworkSecurityGroupRule{
// {
// Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessAllow),
// Priority: to.Ptr[int32](150),
// SourceAddressPrefix: to.Ptr("192.100.12.45"),
// SourcePortRanges: []*string{
// to.Ptr("1"),
// to.Ptr("2")},
// },
// {
// Access: to.Ptr(armbatch.NetworkSecurityGroupRuleAccessDeny),
// Priority: to.Ptr[int32](3500),
// SourceAddressPrefix: to.Ptr("*"),
// SourcePortRanges: []*string{
// to.Ptr("*")},
// }},
// Protocol: to.Ptr(armbatch.InboundEndpointProtocolTCP),
// }},
// },
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
*/
async function createPoolFullVirtualMachineConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
dataDisks: [
{
caching: "ReadWrite",
diskSizeGB: 30,
lun: 0,
storageAccountType: "Premium_LRS",
},
{
caching: "None",
diskSizeGB: 200,
lun: 1,
storageAccountType: "Standard_LRS",
},
],
diskEncryptionConfiguration: { targets: ["OsDisk", "TemporaryDisk"] },
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2016-Datacenter-SmallDisk",
version: "latest",
},
licenseType: "Windows_Server",
nodeAgentSkuId: "batch.node.windows amd64",
nodePlacementConfiguration: { policy: "Zonal" },
osDisk: { ephemeralOSDiskSettings: { placement: "CacheDisk" } },
windowsConfiguration: { enableAutomaticUpdates: false },
},
},
networkConfiguration: {
endpointConfiguration: {
inboundNatPools: [
{
name: "testnat",
backendPort: 12001,
frontendPortRangeEnd: 15100,
frontendPortRangeStart: 15000,
networkSecurityGroupRules: [
{
access: "Allow",
priority: 150,
sourceAddressPrefix: "192.100.12.45",
sourcePortRanges: ["1", "2"],
},
{
access: "Deny",
priority: 3500,
sourceAddressPrefix: "*",
sourcePortRanges: ["*"],
},
],
protocol: "TCP",
},
],
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "MicrosoftWindowsServer",
Offer = "WindowsServer",
Sku = "2016-Datacenter-SmallDisk",
Version = "latest",
}, "batch.node.windows amd64")
{
IsAutomaticUpdateEnabled = false,
DataDisks =
{
new BatchVmDataDisk(0,30)
{
Caching = BatchDiskCachingType.ReadWrite,
StorageAccountType = BatchStorageAccountType.PremiumLrs,
},new BatchVmDataDisk(1,200)
{
Caching = BatchDiskCachingType.None,
StorageAccountType = BatchStorageAccountType.StandardLrs,
}
},
LicenseType = "Windows_Server",
DiskEncryptionTargets =
{
BatchDiskEncryptionTarget.OSDisk,BatchDiskEncryptionTarget.TemporaryDisk
},
NodePlacementPolicy = BatchNodePlacementPolicyType.Zonal,
EphemeralOSDiskPlacement = BatchDiffDiskPlacement.CacheDisk,
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
EndpointInboundNatPools =
{
new BatchInboundNatPool("testnat",BatchInboundEndpointProtocol.Tcp,12001,15000,15100)
{
NetworkSecurityGroupRules =
{
new BatchNetworkSecurityGroupRule(150,BatchNetworkSecurityGroupRuleAccess.Allow,"192.100.12.45")
{
SourcePortRanges =
{
"1","2"
},
},new BatchNetworkSecurityGroupRule(3500,BatchNetworkSecurityGroupRuleAccess.Deny,"*")
{
SourcePortRanges =
{
"*"
},
}
},
}
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter-SmallDisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"licenseType": "Windows_Server",
"dataDisks": [
{
"lun": 0,
"caching": "ReadWrite",
"diskSizeGB": 30,
"storageAccountType": "Premium_LRS"
},
{
"lun": 1,
"caching": "None",
"diskSizeGB": 200,
"storageAccountType": "Standard_LRS"
}
],
"diskEncryptionConfiguration": {
"targets": [
"OsDisk",
"TemporaryDisk"
]
},
"nodePlacementConfiguration": {
"policy": "Zonal"
}
}
},
"networkConfiguration": {
"endpointConfiguration": {
"inboundNatPools": [
{
"name": "testnat",
"protocol": "TCP",
"backendPort": 12001,
"frontendPortRangeStart": 15000,
"frontendPortRangeEnd": 15100,
"networkSecurityGroupRules": [
{
"access": "Allow",
"sourceAddressPrefix": "192.100.12.45",
"priority": 150,
"sourcePortRanges": [
"1",
"2"
]
},
{
"access": "Deny",
"sourceAddressPrefix": "*",
"priority": 3500,
"sourcePortRanges": [
"*"
]
}
]
}
]
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Minimal CloudServiceConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "5"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 3
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_minimal_cloud_service_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {"cloudServiceConfiguration": {"osFamily": "5"}},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 3}},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
func ExamplePoolClient_Create_createPoolMinimalCloudServiceConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
OSFamily: to.Ptr("5"),
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](3),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// CloudServiceConfiguration: &armbatch.CloudServiceConfiguration{
// OSFamily: to.Ptr("5"),
// OSVersion: to.Ptr("*"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](3),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](3),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
*/
async function createPoolMinimalCloudServiceConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: { cloudServiceConfiguration: { osFamily: "5" } },
scaleSettings: { fixedScale: { targetDedicatedNodes: 3 } },
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalCloudServiceConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
CloudServiceConfiguration = new BatchCloudServiceConfiguration("5"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
FixedScale = new BatchAccountFixedScaleSettings()
{
TargetDedicatedNodes = 3,
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"cloudServiceConfiguration": {
"osFamily": "5",
"osVersion": "*"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 3,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"resizeOperationStatus": {
"startTime": "2017-08-28T10:22:55.9407275Z",
"targetDedicatedNodes": 3,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M"
}
}
}
CreatePool - Minimal VirtualMachineConfiguration
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_minimal_virtual_machine_configuration.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18.04-LTS",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
func ExamplePoolClient_Create_createPoolMinimalVirtualMachineConfiguration() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18.04-LTS"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18.04-LTS"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
*/
async function createPoolMinimalVirtualMachineConfiguration() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18.04-LTS",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_MinimalVirtualMachineConfiguration.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "18.04-LTS",
Version = "latest",
}, "batch.node.ubuntu 18.04"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - No public IP
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "NoPublicIPAddresses"
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_no_public_ip_addresses.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"networkConfiguration": {
"publicIPAddressConfiguration": {"provision": "NoPublicIPAddresses"},
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
func ExamplePoolClient_Create_createPoolNoPublicIp() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
Provision: to.Ptr(armbatch.IPAddressProvisioningTypeNoPublicIPAddresses),
},
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
// Provision: to.Ptr(armbatch.IPAddressProvisioningTypeNoPublicIPAddresses),
// },
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// TargetDedicatedNodes: to.Ptr[int32](0),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
*/
async function createPoolNoPublicIP() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
networkConfiguration: {
publicIPAddressConfiguration: { provision: "NoPublicIPAddresses" },
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
}, "batch.node.ubuntu 18.04"),
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
PublicIPAddressConfiguration = new BatchPublicIPAddressConfiguration()
{
Provision = BatchIPAddressProvisioningType.NoPublicIPAddresses,
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "NoPublicIPAddresses"
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 0,
"targetLowPriorityNodes": 0
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - Public IPs
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"
]
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_public_ips.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"networkConfiguration": {
"publicIPAddressConfiguration": {
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"
],
"provision": "UserManaged",
},
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
func ExamplePoolClient_Create_createPoolPublicIPs() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
NetworkConfiguration: &armbatch.NetworkConfiguration{
PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
IPAddressIDs: []*string{
to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135")},
Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
},
SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateSteady),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// NetworkConfiguration: &armbatch.NetworkConfiguration{
// PublicIPAddressConfiguration: &armbatch.PublicIPAddressConfiguration{
// IPAddressIDs: []*string{
// to.Ptr("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135")},
// Provision: to.Ptr(armbatch.IPAddressProvisioningTypeUserManaged),
// },
// SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
// },
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// TargetDedicatedNodes: to.Ptr[int32](0),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
*/
async function createPoolPublicIPs() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
id: "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
networkConfiguration: {
publicIPAddressConfiguration: {
ipAddressIds: [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
],
provision: "UserManaged",
},
subnetId:
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Id = new ResourceIdentifier("/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"),
}, "batch.node.ubuntu 18.04"),
},
NetworkConfiguration = new BatchNetworkConfiguration()
{
SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123"),
PublicIPAddressConfiguration = new BatchPublicIPAddressConfiguration()
{
Provision = BatchIPAddressProvisioningType.UserManaged,
IPAddressIds =
{
new ResourceIdentifier("/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135")
},
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Steady",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"networkConfiguration": {
"subnetId": "/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123",
"publicIPAddressConfiguration": {
"provision": "UserManaged",
"ipAddressIds": [
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"
]
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"id": "/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 0,
"targetLowPriorityNodes": 0
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"resourceTags": {
"TagName1": "TagValue1",
"TagName2": "TagValue2"
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_resource_tags.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18_04-lts-gen2",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"resourceTags": {"TagName1": "TagValue1", "TagName2": "TagValue2"},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
func ExamplePoolClient_Create_createPoolResourceTags() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18_04-lts-gen2"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
ResourceTags: map[string]*string{
"TagName1": to.Ptr("TagValue1"),
"TagName2": to.Ptr("TagValue2"),
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB554F8E08BCF4\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18_04-lts-gen2"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-09-27T07:33:13.062Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ResourceTags: map[string]*string{
// "TagName1": to.Ptr("TagValue1"),
// "TagName2": to.Ptr("TagValue2"),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
*/
async function createPoolResourceTags() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18_04-lts-gen2",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
resourceTags: { tagName1: "TagValue1", tagName2: "TagValue2" },
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB554F8E08BCF4"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB554F8E08BCF4\"",
"properties": {
"lastModified": "2023-06-14T07:03:58.3231917Z",
"creationTime": "2023-06-14T07:03:58.3231917Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-09-27T07:33:13.0625789Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"resourceTags": {
"TagName1": "TagValue1",
"TagName2": "TagValue2"
}
}
}
CreatePool - SecurityProfile
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
"securityProfile": {
"securityType": "trustedLaunch",
"encryptionAtHost": true,
"uefiSettings": {
"secureBootEnabled": null,
"vTpmEnabled": false
}
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_security_profile.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18_04-lts-gen2",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
"securityProfile": {
"encryptionAtHost": True,
"securityType": "trustedLaunch",
"uefiSettings": {"secureBootEnabled": None, "vTpmEnabled": False},
},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
func ExamplePoolClient_Create_createPoolSecurityProfile() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18_04-lts-gen2"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
SecurityProfile: &armbatch.SecurityProfile{
EncryptionAtHost: to.Ptr(true),
SecurityType: to.Ptr("trustedLaunch"),
UefiSettings: &armbatch.UefiSettings{
VTpmEnabled: to.Ptr(false),
},
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB554F8E08BCF4\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18_04-lts-gen2"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// SecurityProfile: &armbatch.SecurityProfile{
// EncryptionAtHost: to.Ptr(true),
// SecurityType: to.Ptr("trustedLaunch"),
// UefiSettings: &armbatch.UefiSettings{
// VTpmEnabled: to.Ptr(false),
// },
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-06-14T07:03:58.323Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
*/
async function createPoolSecurityProfile() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18_04-lts-gen2",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
securityProfile: {
encryptionAtHost: true,
securityType: "trustedLaunch",
uefiSettings: { secureBootEnabled: undefined, vTpmEnabled: false },
},
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.batch.models.ApplicationPackageReference;
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.AutoUserScope;
import com.azure.resourcemanager.batch.models.AutoUserSpecification;
import com.azure.resourcemanager.batch.models.AutomaticOSUpgradePolicy;
import com.azure.resourcemanager.batch.models.BatchPoolIdentity;
import com.azure.resourcemanager.batch.models.CachingType;
import com.azure.resourcemanager.batch.models.CertificateReference;
import com.azure.resourcemanager.batch.models.CertificateStoreLocation;
import com.azure.resourcemanager.batch.models.CertificateVisibility;
import com.azure.resourcemanager.batch.models.CloudServiceConfiguration;
import com.azure.resourcemanager.batch.models.ComputeNodeDeallocationOption;
import com.azure.resourcemanager.batch.models.ComputeNodeFillType;
import com.azure.resourcemanager.batch.models.DataDisk;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.DiffDiskPlacement;
import com.azure.resourcemanager.batch.models.DiffDiskSettings;
import com.azure.resourcemanager.batch.models.DiskEncryptionConfiguration;
import com.azure.resourcemanager.batch.models.DiskEncryptionTarget;
import com.azure.resourcemanager.batch.models.ElevationLevel;
import com.azure.resourcemanager.batch.models.EnvironmentSetting;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.InboundEndpointProtocol;
import com.azure.resourcemanager.batch.models.InboundNatPool;
import com.azure.resourcemanager.batch.models.InterNodeCommunicationState;
import com.azure.resourcemanager.batch.models.IpAddressProvisioningType;
import com.azure.resourcemanager.batch.models.LinuxUserConfiguration;
import com.azure.resourcemanager.batch.models.ManagedDisk;
import com.azure.resourcemanager.batch.models.MetadataItem;
import com.azure.resourcemanager.batch.models.NetworkConfiguration;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRule;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRuleAccess;
import com.azure.resourcemanager.batch.models.NodeCommunicationMode;
import com.azure.resourcemanager.batch.models.NodePlacementConfiguration;
import com.azure.resourcemanager.batch.models.NodePlacementPolicyType;
import com.azure.resourcemanager.batch.models.OSDisk;
import com.azure.resourcemanager.batch.models.PoolEndpointConfiguration;
import com.azure.resourcemanager.batch.models.PoolIdentityType;
import com.azure.resourcemanager.batch.models.PublicIpAddressConfiguration;
import com.azure.resourcemanager.batch.models.ResourceFile;
import com.azure.resourcemanager.batch.models.RollingUpgradePolicy;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.SecurityProfile;
import com.azure.resourcemanager.batch.models.SecurityTypes;
import com.azure.resourcemanager.batch.models.StartTask;
import com.azure.resourcemanager.batch.models.StorageAccountType;
import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy;
import com.azure.resourcemanager.batch.models.UefiSettings;
import com.azure.resourcemanager.batch.models.UpgradeMode;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.UserAccount;
import com.azure.resourcemanager.batch.models.UserAssignedIdentities;
import com.azure.resourcemanager.batch.models.UserIdentity;
import com.azure.resourcemanager.batch.models.VMExtension;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.batch.models.WindowsConfiguration;
import java.io.IOException;
import java.time.Duration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Pool Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SecurityProfile.json
*/
/**
* Sample code: CreatePool - SecurityProfile.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolSecurityProfile(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer")
.withSku("18_04-lts-gen2").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")
.withSecurityProfile(new SecurityProfile().withSecurityType(SecurityTypes.TRUSTED_LAUNCH)
.withEncryptionAtHost(true).withUefiSettings(new UefiSettings().withVTpmEnabled(false)))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration OSDisk.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolVirtualMachineConfigurationOSDisk(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d2s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("microsoftwindowsserver")
.withOffer("windowsserver").withSku("2022-datacenter-smalldisk"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withOsDisk(new OSDisk().withCaching(CachingType.READ_WRITE)
.withManagedDisk(new ManagedDisk().withStorageAccountType(StorageAccountType.STANDARD_SSD_LRS))
.withDiskSizeGB(100).withWriteAcceleratorEnabled(false))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalCloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration()
.withCloudServiceConfiguration(new CloudServiceConfiguration().withOsFamily("5")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(3)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalVirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_Extensions.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration Extensions.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolVirtualMachineConfigurationExtensions(
com.azure.resourcemanager.batch.BatchManager manager) throws IOException {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("0001-com-ubuntu-server-focal").withSku("20_04-lts"))
.withNodeAgentSkuId("batch.node.ubuntu 20.04")
.withExtensions(Arrays.asList(new VMExtension().withName("batchextension1")
.withPublisher("Microsoft.Azure.KeyVault").withType("KeyVaultForLinux")
.withTypeHandlerVersion("2.0").withAutoUpgradeMinorVersion(true)
.withEnableAutomaticUpgrade(true)
.withSettings(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"authenticationSettingsKey\":\"authenticationSettingsValue\",\"secretsManagementSettingsKey\":\"secretsManagementSettingsValue\"}",
Object.class, SerializerEncoding.JSON))))))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.withTargetNodeCommunicationMode(NodeCommunicationMode.DEFAULT).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities
* .json
*/
/**
* Sample code: CreatePool - UserAssignedIdentities.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUserAssignedIdentities(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withIdentity(new BatchPoolIdentity().withType(PoolIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1",
new UserAssignedIdentities(),
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2",
new UserAssignedIdentities())))
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
*/
/**
* Sample code: CreatePool - UpgradePolicy.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUpgradePolicy(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2019-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(2).withTargetLowPriorityNodes(0)))
.withUpgradePolicy(
new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)
.withAutomaticOSUpgradePolicy(new AutomaticOSUpgradePolicy().withDisableAutomaticRollback(true)
.withEnableAutomaticOSUpgrade(true).withUseRollingUpgradePolicy(true)
.withOsRollingUpgradeDeferral(true))
.withRollingUpgradePolicy(new RollingUpgradePolicy().withEnableCrossZoneUpgrade(true)
.withMaxBatchInstancePercent(20).withMaxUnhealthyInstancePercent(20)
.withMaxUnhealthyUpgradedInstancePercent(20).withPauseTimeBetweenBatches("PT0S")
.withPrioritizeUnhealthyInstances(false).withRollbackFailedInstancesOnPolicyBreach(false)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.
* json
*/
/**
* Sample code: CreatePool - accelerated networking.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolAcceleratedNetworking(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D1_V2")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withEnableAcceleratedNetworking(true))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Full VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-Datacenter-SmallDisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withDataDisks(Arrays.asList(
new DataDisk().withLun(0).withCaching(CachingType.READ_WRITE).withDiskSizeGB(30)
.withStorageAccountType(StorageAccountType.PREMIUM_LRS),
new DataDisk().withLun(1).withCaching(CachingType.NONE).withDiskSizeGB(200)
.withStorageAccountType(StorageAccountType.STANDARD_LRS)))
.withLicenseType("Windows_Server")
.withDiskEncryptionConfiguration(new DiskEncryptionConfiguration().withTargets(
Arrays.asList(DiskEncryptionTarget.OS_DISK, DiskEncryptionTarget.TEMPORARY_DISK)))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))
.withOsDisk(new OSDisk().withEphemeralOSDiskSettings(
new DiffDiskSettings().withPlacement(DiffDiskPlacement.CACHE_DISK)))))
.withScaleSettings(
new ScaleSettings()
.withAutoScale(
new AutoScaleSettings().withFormula(
"$TargetDedicatedNodes=1").withEvaluationInterval(
Duration.parse("PT5M"))))
.withNetworkConfiguration(
new NetworkConfiguration()
.withEndpointConfiguration(new PoolEndpointConfiguration().withInboundNatPools(
Arrays.asList(new InboundNatPool().withName("testnat").withProtocol(InboundEndpointProtocol.TCP)
.withBackendPort(12001).withFrontendPortRangeStart(15000).withFrontendPortRangeEnd(15100)
.withNetworkSecurityGroupRules(Arrays.asList(new NetworkSecurityGroupRule()
.withPriority(150).withAccess(NetworkSecurityGroupRuleAccess.ALLOW)
.withSourceAddressPrefix("192.100.12.45").withSourcePortRanges(Arrays.asList("1", "2")),
new NetworkSecurityGroupRule().withPriority(3500)
.withAccess(NetworkSecurityGroupRuleAccess.DENY).withSourceAddressPrefix("*")
.withSourcePortRanges(Arrays.asList("*"))))))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.
* json
*/
/**
* Sample code: CreatePool - Custom Image.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolCustomImage(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_CloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Full CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withDisplayName("my-pool-name").withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withCloudServiceConfiguration(
new CloudServiceConfiguration().withOsFamily("4").withOsVersion("WA-GUEST-OS-4.45_201708-01")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings()
.withResizeTimeout(Duration.parse("PT8M")).withTargetDedicatedNodes(6).withTargetLowPriorityNodes(28)
.withNodeDeallocationOption(ComputeNodeDeallocationOption.TASK_COMPLETION)))
.withInterNodeCommunication(InterNodeCommunicationState.ENABLED)
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"))))
.withTaskSlotsPerNode(13)
.withTaskSchedulingPolicy(new TaskSchedulingPolicy().withNodeFillType(ComputeNodeFillType.PACK))
.withUserAccounts(Arrays.asList(new UserAccount().withName("username1").withPassword("fakeTokenPlaceholder")
.withElevationLevel(ElevationLevel.ADMIN)
.withLinuxUserConfiguration(new LinuxUserConfiguration().withUid(1234).withGid(4567)
.withSshPrivateKey("fakeTokenPlaceholder"))))
.withMetadata(Arrays.asList(new MetadataItem().withName("metadata-1").withValue("value-1"),
new MetadataItem().withName("metadata-2").withValue("value-2")))
.withStartTask(new StartTask().withCommandLine("cmd /c SET")
.withResourceFiles(Arrays.asList(
new ResourceFile().withHttpUrl("https://testaccount.blob.core.windows.net/example-blob-file")
.withFilePath("c:\\temp\\gohere").withFileMode("777")))
.withEnvironmentSettings(Arrays.asList(new EnvironmentSetting().withName("MYSET").withValue("1234")))
.withUserIdentity(new UserIdentity().withAutoUser(
new AutoUserSpecification().withScope(AutoUserScope.POOL).withElevationLevel(ElevationLevel.ADMIN)))
.withMaxTaskRetryCount(6).withWaitForSuccess(true))
.withCertificates(Arrays.asList(new CertificateReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567")
.withStoreLocation(CertificateStoreLocation.LOCAL_MACHINE).withStoreName("MY")
.withVisibility(Arrays.asList(CertificateVisibility.REMOTE_USER))))
.withApplicationPackages(Arrays.asList(new ApplicationPackageReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234")
.withVersion("asdf")))
.withApplicationLicenses(Arrays.asList("app-license0", "app-license1")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.
* json
*/
/**
* Sample code: CreatePool - No public IP.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolNoPublicIP(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(
new PublicIpAddressConfiguration().withProvision(IpAddressProvisioningType.NO_PUBLIC_IPADDRESSES)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
*/
/**
* Sample code: CreatePool - ResourceTags.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolResourceTags(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer")
.withSku("18_04-lts-gen2").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withResourceTags(mapOf("TagName1", "TagValue1", "TagName2", "TagValue2")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
*/
/**
* Sample code: CreatePool - Public IPs.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolPublicIPs(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"))))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB554F8E08BCF4"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB554F8E08BCF4\"",
"properties": {
"lastModified": "2023-06-14T07:03:58.3231917Z",
"creationTime": "2023-06-14T07:03:58.3231917Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-06-14T07:03:58.3231917Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18_04-lts-gen2",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
"securityProfile": {
"securityType": "trustedLaunch",
"encryptionAtHost": true,
"uefiSettings": {
"vTpmEnabled": false
}
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-06-14T07:03:58.3231917Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - UpgradePolicy
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodePlacementConfiguration": {
"policy": "Zonal"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0
}
},
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"disableAutomaticRollback": true,
"enableAutomaticOSUpgrade": true,
"useRollingUpgradePolicy": true,
"osRollingUpgradeDeferral": true
},
"rollingUpgradePolicy": {
"enableCrossZoneUpgrade": true,
"maxBatchInstancePercent": 20,
"maxUnhealthyInstancePercent": 20,
"maxUnhealthyUpgradedInstancePercent": 20,
"pauseTimeBetweenBatches": "PT0S",
"prioritizeUnhealthyInstances": false,
"rollbackFailedInstancesOnPolicyBreach": false
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_upgrade_policy.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.windows amd64",
"nodePlacementConfiguration": {"policy": "Zonal"},
"windowsConfiguration": {"enableAutomaticUpdates": False},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 2, "targetLowPriorityNodes": 0}},
"upgradePolicy": {
"automaticOSUpgradePolicy": {
"disableAutomaticRollback": True,
"enableAutomaticOSUpgrade": True,
"osRollingUpgradeDeferral": True,
"useRollingUpgradePolicy": True,
},
"mode": "automatic",
"rollingUpgradePolicy": {
"enableCrossZoneUpgrade": True,
"maxBatchInstancePercent": 20,
"maxUnhealthyInstancePercent": 20,
"maxUnhealthyUpgradedInstancePercent": 20,
"pauseTimeBetweenBatches": "PT0S",
"prioritizeUnhealthyInstances": False,
"rollbackFailedInstancesOnPolicyBreach": False,
},
},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
func ExamplePoolClient_Create_createPoolUpgradePolicy() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2019-datacenter-smalldisk"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
},
WindowsConfiguration: &armbatch.WindowsConfiguration{
EnableAutomaticUpdates: to.Ptr(false),
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](2),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
UpgradePolicy: &armbatch.UpgradePolicy{
AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
DisableAutomaticRollback: to.Ptr(true),
EnableAutomaticOSUpgrade: to.Ptr(true),
OSRollingUpgradeDeferral: to.Ptr(true),
UseRollingUpgradePolicy: to.Ptr(true),
},
Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
RollingUpgradePolicy: &armbatch.RollingUpgradePolicy{
EnableCrossZoneUpgrade: to.Ptr(true),
MaxBatchInstancePercent: to.Ptr[int32](20),
MaxUnhealthyInstancePercent: to.Ptr[int32](20),
MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](20),
PauseTimeBetweenBatches: to.Ptr("PT0S"),
PrioritizeUnhealthyInstances: to.Ptr(false),
RollbackFailedInstancesOnPolicyBreach: to.Ptr(false),
},
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB51E64D3C3B69\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2019-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// NodePlacementConfiguration: &armbatch.NodePlacementConfiguration{
// Policy: to.Ptr(armbatch.NodePlacementPolicyTypeZonal),
// },
// WindowsConfiguration: &armbatch.WindowsConfiguration{
// EnableAutomaticUpdates: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T06:16:44.237Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](2),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](2),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// UpgradePolicy: &armbatch.UpgradePolicy{
// AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
// DisableAutomaticRollback: to.Ptr(true),
// EnableAutomaticOSUpgrade: to.Ptr(true),
// OSRollingUpgradeDeferral: to.Ptr(true),
// UseRollingUpgradePolicy: to.Ptr(true),
// },
// Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
// RollingUpgradePolicy: &armbatch.RollingUpgradePolicy{
// EnableCrossZoneUpgrade: to.Ptr(true),
// MaxBatchInstancePercent: to.Ptr[int32](20),
// MaxUnhealthyInstancePercent: to.Ptr[int32](20),
// MaxUnhealthyUpgradedInstancePercent: to.Ptr[int32](20),
// PauseTimeBetweenBatches: to.Ptr("PT0S"),
// PrioritizeUnhealthyInstances: to.Ptr(false),
// RollbackFailedInstancesOnPolicyBreach: to.Ptr(false),
// },
// },
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
*/
async function createPoolUpgradePolicy() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2019-datacenter-smalldisk",
version: "latest",
},
nodeAgentSkuId: "batch.node.windows amd64",
nodePlacementConfiguration: { policy: "Zonal" },
windowsConfiguration: { enableAutomaticUpdates: false },
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 2, targetLowPriorityNodes: 0 },
},
upgradePolicy: {
automaticOSUpgradePolicy: {
disableAutomaticRollback: true,
enableAutomaticOSUpgrade: true,
osRollingUpgradeDeferral: true,
useRollingUpgradePolicy: true,
},
mode: "automatic",
rollingUpgradePolicy: {
enableCrossZoneUpgrade: true,
maxBatchInstancePercent: 20,
maxUnhealthyInstancePercent: 20,
maxUnhealthyUpgradedInstancePercent: 20,
pauseTimeBetweenBatches: "PT0S",
prioritizeUnhealthyInstances: false,
rollbackFailedInstancesOnPolicyBreach: false,
},
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB51E64D3C3B69"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB51E64D3C3B69\"",
"properties": {
"lastModified": "2023-05-11T06:16:44.2372184Z",
"creationTime": "2023-05-11T06:16:44.2372184Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-05-11T06:16:44.2372184Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-05-11T06:16:44.2372184Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"nodePlacementConfiguration": {
"policy": "Zonal"
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 2,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-05-11T06:16:44.2372184Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"disableAutomaticRollback": true,
"enableAutomaticOSUpgrade": true,
"useRollingUpgradePolicy": true,
"osRollingUpgradeDeferral": true
},
"rollingUpgradePolicy": {
"enableCrossZoneUpgrade": true,
"maxBatchInstancePercent": 20,
"maxUnhealthyInstancePercent": 20,
"maxUnhealthyUpgradedInstancePercent": 20,
"pauseTimeBetweenBatches": "PT0S",
"prioritizeUnhealthyInstances": false,
"rollbackFailedInstancesOnPolicyBreach": false
}
}
}
}
CreatePool - UserAssignedIdentities
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
}
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_user_assigned_identities.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {},
},
},
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "UbuntuServer",
"publisher": "Canonical",
"sku": "18.04-LTS",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04",
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"vmSize": "STANDARD_D4",
},
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
func ExamplePoolClient_Create_createPoolUserAssignedIdentities() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Identity: &armbatch.PoolIdentity{
Type: to.Ptr(armbatch.PoolIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armbatch.UserAssignedIdentities{
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {},
},
},
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("UbuntuServer"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("18.04-LTS"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Identity: &armbatch.PoolIdentity{
// Type: to.Ptr(armbatch.PoolIdentityTypeUserAssigned),
// UserAssignedIdentities: map[string]*armbatch.UserAssignedIdentities{
// "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armbatch.UserAssignedIdentities{
// ClientID: to.Ptr("clientId1"),
// PrincipalID: to.Ptr("principalId1"),
// },
// "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": &armbatch.UserAssignedIdentities{
// ClientID: to.Ptr("clientId2"),
// PrincipalID: to.Ptr("principalId2"),
// },
// },
// },
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("UbuntuServer"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("18.04-LTS"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 18.04"),
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-01T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
*/
async function createPoolUserAssignedIdentities() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "UbuntuServer",
publisher: "Canonical",
sku: "18.04-LTS",
version: "latest",
},
nodeAgentSkuId: "batch.node.ubuntu 18.04",
},
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1":
{},
"/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2":
{},
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
Identity = new ManagedServiceIdentity("UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(),
[new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity(),
},
},
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "UbuntuServer",
Sku = "18.04-LTS",
Version = "latest",
}, "batch.node.ubuntu 18.04"),
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2020-10-01T10:22:55.9407275Z",
"creationTime": "2020-10-01T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2020-10-01T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2020-10-01T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "18.04-LTS",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.ubuntu 18.04"
}
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {
"principalId": "principalId1",
"clientId": "clientId1"
},
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2": {
"principalId": "principalId2",
"clientId": "clientId2"
}
}
}
}
CreatePool - VirtualMachineConfiguration Extensions
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "STANDARD_D4",
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-focal",
"sku": "20_04-lts"
},
"nodeAgentSkuId": "batch.node.ubuntu 20.04",
"extensions": [
{
"name": "batchextension1",
"type": "KeyVaultForLinux",
"publisher": "Microsoft.Azure.KeyVault",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"enableAutomaticUpgrade": true,
"settings": {
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
"authenticationSettingsKey": "authenticationSettingsValue"
}
}
]
}
},
"targetNodeCommunicationMode": "Default"
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration_extensions.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"extensions": [
{
"autoUpgradeMinorVersion": True,
"enableAutomaticUpgrade": True,
"name": "batchextension1",
"publisher": "Microsoft.Azure.KeyVault",
"settings": {
"authenticationSettingsKey": "authenticationSettingsValue",
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
},
"type": "KeyVaultForLinux",
"typeHandlerVersion": "2.0",
}
],
"imageReference": {
"offer": "0001-com-ubuntu-server-focal",
"publisher": "Canonical",
"sku": "20_04-lts",
},
"nodeAgentSkuId": "batch.node.ubuntu 20.04",
}
},
"scaleSettings": {"autoScale": {"evaluationInterval": "PT5M", "formula": "$TargetDedicatedNodes=1"}},
"targetNodeCommunicationMode": "Default",
"vmSize": "STANDARD_D4",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
func ExamplePoolClient_Create_createPoolVirtualMachineConfigurationExtensions() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("0001-com-ubuntu-server-focal"),
Publisher: to.Ptr("Canonical"),
SKU: to.Ptr("20_04-lts"),
},
NodeAgentSKUID: to.Ptr("batch.node.ubuntu 20.04"),
Extensions: []*armbatch.VMExtension{
{
Name: to.Ptr("batchextension1"),
Type: to.Ptr("KeyVaultForLinux"),
AutoUpgradeMinorVersion: to.Ptr(true),
EnableAutomaticUpgrade: to.Ptr(true),
Publisher: to.Ptr("Microsoft.Azure.KeyVault"),
Settings: map[string]any{
"authenticationSettingsKey": "authenticationSettingsValue",
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
},
TypeHandlerVersion: to.Ptr("2.0"),
}},
},
},
ScaleSettings: &armbatch.ScaleSettings{
AutoScale: &armbatch.AutoScaleSettings{
EvaluationInterval: to.Ptr("PT5M"),
Formula: to.Ptr("$TargetDedicatedNodes=1"),
},
},
TargetNodeCommunicationMode: to.Ptr(armbatch.NodeCommunicationModeDefault),
VMSize: to.Ptr("STANDARD_D4"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8D4EDFEBFADF4AB\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("0001-com-ubuntu-server-focal"),
// Publisher: to.Ptr("Canonical"),
// SKU: to.Ptr("20_04-lts"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.ubuntu 20.04"),
// Extensions: []*armbatch.VMExtension{
// {
// Name: to.Ptr("batchextension1"),
// Type: to.Ptr("KeyVaultForLinux"),
// AutoUpgradeMinorVersion: to.Ptr(true),
// EnableAutomaticUpgrade: to.Ptr(true),
// Publisher: to.Ptr("Microsoft.Azure.KeyVault"),
// Settings: map[string]any{
// "authenticationSettingsKey": "authenticationSettingsValue",
// "secretsManagementSettingsKey": "secretsManagementSettingsValue",
// },
// TypeHandlerVersion: to.Ptr("2.0"),
// }},
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-08-28T10:22:55.940Z"); return t}()),
// ScaleSettings: &armbatch.ScaleSettings{
// AutoScale: &armbatch.AutoScaleSettings{
// EvaluationInterval: to.Ptr("PT5M"),
// Formula: to.Ptr("$TargetDedicatedNodes=1"),
// },
// },
// TargetNodeCommunicationMode: to.Ptr(armbatch.NodeCommunicationModeDefault),
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D4"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
*/
async function createPoolVirtualMachineConfigurationExtensions() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "0001-com-ubuntu-server-focal",
publisher: "Canonical",
sku: "20_04-lts",
},
nodeAgentSkuId: "batch.node.ubuntu 20.04",
extensions: [
{
name: "batchextension1",
type: "KeyVaultForLinux",
autoUpgradeMinorVersion: true,
enableAutomaticUpgrade: true,
publisher: "Microsoft.Azure.KeyVault",
settings: {
authenticationSettingsKey: "authenticationSettingsValue",
secretsManagementSettingsKey: "secretsManagementSettingsValue",
},
typeHandlerVersion: "2.0",
},
],
},
},
scaleSettings: {
autoScale: {
evaluationInterval: "PT5M",
formula: "$TargetDedicatedNodes=1",
},
},
targetNodeCommunicationMode: "Default",
vmSize: "STANDARD_D4",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_Extensions.json
// this example is just showing the usage of "Pool_Create" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this BatchAccountResource created on azure
// for more information of creating BatchAccountResource, please refer to the document of BatchAccountResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
string accountName = "sampleacct";
ResourceIdentifier batchAccountResourceId = BatchAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName);
BatchAccountResource batchAccount = client.GetBatchAccountResource(batchAccountResourceId);
// get the collection of this BatchAccountPoolResource
BatchAccountPoolCollection collection = batchAccount.GetBatchAccountPools();
// invoke the operation
string poolName = "testpool";
BatchAccountPoolData data = new BatchAccountPoolData()
{
VmSize = "STANDARD_D4",
DeploymentConfiguration = new BatchDeploymentConfiguration()
{
VmConfiguration = new BatchVmConfiguration(new BatchImageReference()
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-focal",
Sku = "20_04-lts",
}, "batch.node.ubuntu 20.04")
{
Extensions =
{
new BatchVmExtension("batchextension1","Microsoft.Azure.KeyVault","KeyVaultForLinux")
{
TypeHandlerVersion = "2.0",
AutoUpgradeMinorVersion = true,
EnableAutomaticUpgrade = true,
Settings = BinaryData.FromObjectAsJson(new Dictionary<string, object>()
{
["authenticationSettingsKey"] = "authenticationSettingsValue",
["secretsManagementSettingsKey"] = "secretsManagementSettingsValue"}),
}
},
},
},
ScaleSettings = new BatchAccountPoolScaleSettings()
{
AutoScale = new BatchAccountAutoScaleSettings("$TargetDedicatedNodes=1")
{
EvaluationInterval = XmlConvert.ToTimeSpan("PT5M"),
},
},
TargetNodeCommunicationMode = NodeCommunicationMode.Default,
};
ArmOperation<BatchAccountPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, poolName, data);
BatchAccountPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
BatchAccountPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8D4EDFEBFADF4AB"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8D4EDFEBFADF4AB\"",
"properties": {
"lastModified": "2017-08-28T10:22:55.9407275Z",
"creationTime": "2017-08-28T10:22:55.9407275Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2017-08-28T10:22:55.9407275Z",
"vmSize": "STANDARD_D4",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"scaleSettings": {
"autoScale": {
"formula": "$TargetDedicatedNodes=1",
"evaluationInterval": "PT5M"
}
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-focal",
"sku": "20_04-lts"
},
"nodeAgentSkuId": "batch.node.ubuntu 20.04",
"extensions": [
{
"name": "batchextension1",
"type": "KeyVaultForLinux",
"publisher": "Microsoft.Azure.KeyVault",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"enableAutomaticUpgrade": true,
"settings": {
"secretsManagementSettingsKey": "secretsManagementSettingsValue",
"authenticationSettingsKey": "authenticationSettingsValue"
}
}
]
}
},
"targetNodeCommunicationMode": "Default"
}
}
CreatePool - VirtualMachineConfiguration OSDisk
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d2s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "microsoftwindowsserver",
"offer": "windowsserver",
"sku": "2022-datacenter-smalldisk"
},
"osDisk": {
"diskSizeGB": 100,
"managedDisk": {
"storageAccountType": "StandardSSD_LRS"
},
"caching": "ReadWrite",
"writeAcceleratorEnabled": false
},
"nodeAgentSkuId": "batch.node.windows amd64"
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration_managed_os_disk.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "windowsserver",
"publisher": "microsoftwindowsserver",
"sku": "2022-datacenter-smalldisk",
},
"nodeAgentSkuId": "batch.node.windows amd64",
"osDisk": {
"caching": "ReadWrite",
"diskSizeGB": 100,
"managedDisk": {"storageAccountType": "StandardSSD_LRS"},
"writeAcceleratorEnabled": False,
},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 1, "targetLowPriorityNodes": 0}},
"vmSize": "Standard_d2s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
func ExamplePoolClient_Create_createPoolVirtualMachineConfigurationOsDisk() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("windowsserver"),
Publisher: to.Ptr("microsoftwindowsserver"),
SKU: to.Ptr("2022-datacenter-smalldisk"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
OSDisk: &armbatch.OSDisk{
Caching: to.Ptr(armbatch.CachingTypeReadWrite),
DiskSizeGB: to.Ptr[int32](100),
ManagedDisk: &armbatch.ManagedDisk{
StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardSSDLRS),
},
WriteAcceleratorEnabled: to.Ptr(false),
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](1),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
VMSize: to.Ptr("Standard_d2s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("testpool"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB51F396992B8D\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("windowsserver"),
// Publisher: to.Ptr("microsoftwindowsserver"),
// SKU: to.Ptr("2022-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// OSDisk: &armbatch.OSDisk{
// Caching: to.Ptr(armbatch.CachingTypeReadWrite),
// DiskSizeGB: to.Ptr[int32](100),
// ManagedDisk: &armbatch.ManagedDisk{
// StorageAccountType: to.Ptr(armbatch.StorageAccountTypeStandardSSDLRS),
// },
// WriteAcceleratorEnabled: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-24T02:12:27.752Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](1),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](1),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// VMSize: to.Ptr("STANDARD_D2_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
*/
async function createPoolVirtualMachineConfigurationOSDisk() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "windowsserver",
publisher: "microsoftwindowsserver",
sku: "2022-datacenter-smalldisk",
},
nodeAgentSkuId: "batch.node.windows amd64",
osDisk: {
caching: "ReadWrite",
diskSizeGB: 100,
managedDisk: { storageAccountType: "StandardSSD_LRS" },
writeAcceleratorEnabled: false,
},
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 1, targetLowPriorityNodes: 0 },
},
vmSize: "Standard_d2s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB51F14DC1A8AD"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "testpool",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB51F396992B8D\"",
"properties": {
"lastModified": "2023-08-24T02:12:27.7527697Z",
"creationTime": "2023-08-24T02:12:27.7527697Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-08-24T02:12:27.7527697Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-08-24T02:12:27.7527697Z",
"vmSize": "STANDARD_D2_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "microsoftwindowsserver",
"offer": "windowsserver",
"sku": "2022-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"osDisk": {
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "StandardSSD_LRS"
},
"diskSizeGB": 100,
"writeAcceleratorEnabled": false
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 1,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 1,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-08-24T02:12:27.7527697Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0
}
}
CreatePool - VirtualMachineConfiguration ServiceArtifactReference
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool?api-version=2024-02-01
{
"properties": {
"vmSize": "Standard_d4s_v3",
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"serviceArtifactReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0
}
},
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"enableAutomaticOSUpgrade": true
}
}
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python pool_create_virtual_machine_configuration_service_artifact_reference.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = BatchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.pool.create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
pool_name="testpool",
parameters={
"properties": {
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"offer": "WindowsServer",
"publisher": "MicrosoftWindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest",
},
"nodeAgentSkuId": "batch.node.windows amd64",
"serviceArtifactReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"
},
"windowsConfiguration": {"enableAutomaticUpdates": False},
}
},
"scaleSettings": {"fixedScale": {"targetDedicatedNodes": 2, "targetLowPriorityNodes": 0}},
"upgradePolicy": {"automaticOSUpgradePolicy": {"enableAutomaticOSUpgrade": True}, "mode": "automatic"},
"vmSize": "Standard_d4s_v3",
}
},
)
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armbatch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/batch/armbatch/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
func ExamplePoolClient_Create_createPoolVirtualMachineConfigurationServiceArtifactReference() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armbatch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewPoolClient().Create(ctx, "default-azurebatch-japaneast", "sampleacct", "testpool", armbatch.Pool{
Properties: &armbatch.PoolProperties{
DeploymentConfiguration: &armbatch.DeploymentConfiguration{
VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
ImageReference: &armbatch.ImageReference{
Offer: to.Ptr("WindowsServer"),
Publisher: to.Ptr("MicrosoftWindowsServer"),
SKU: to.Ptr("2019-datacenter-smalldisk"),
Version: to.Ptr("latest"),
},
NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
ServiceArtifactReference: &armbatch.ServiceArtifactReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"),
},
WindowsConfiguration: &armbatch.WindowsConfiguration{
EnableAutomaticUpdates: to.Ptr(false),
},
},
},
ScaleSettings: &armbatch.ScaleSettings{
FixedScale: &armbatch.FixedScaleSettings{
TargetDedicatedNodes: to.Ptr[int32](2),
TargetLowPriorityNodes: to.Ptr[int32](0),
},
},
UpgradePolicy: &armbatch.UpgradePolicy{
AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
EnableAutomaticOSUpgrade: to.Ptr(true),
},
Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
},
VMSize: to.Ptr("Standard_d4s_v3"),
},
}, &armbatch.PoolClientCreateOptions{IfMatch: nil,
IfNoneMatch: nil,
})
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.Pool = armbatch.Pool{
// Name: to.Ptr("mypool41"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts/pools"),
// Etag: to.Ptr("W/\"0x8DB51F396992B8D\""),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool"),
// Properties: &armbatch.PoolProperties{
// AllocationState: to.Ptr(armbatch.AllocationStateResizing),
// AllocationStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// CurrentDedicatedNodes: to.Ptr[int32](0),
// CurrentLowPriorityNodes: to.Ptr[int32](0),
// DeploymentConfiguration: &armbatch.DeploymentConfiguration{
// VirtualMachineConfiguration: &armbatch.VirtualMachineConfiguration{
// ImageReference: &armbatch.ImageReference{
// Offer: to.Ptr("WindowsServer"),
// Publisher: to.Ptr("MicrosoftWindowsServer"),
// SKU: to.Ptr("2019-datacenter-smalldisk"),
// Version: to.Ptr("latest"),
// },
// NodeAgentSKUID: to.Ptr("batch.node.windows amd64"),
// ServiceArtifactReference: &armbatch.ServiceArtifactReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"),
// },
// WindowsConfiguration: &armbatch.WindowsConfiguration{
// EnableAutomaticUpdates: to.Ptr(false),
// },
// },
// },
// InterNodeCommunication: to.Ptr(armbatch.InterNodeCommunicationStateDisabled),
// LastModified: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// ProvisioningState: to.Ptr(armbatch.PoolProvisioningStateSucceeded),
// ProvisioningStateTransitionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// ResizeOperationStatus: &armbatch.ResizeOperationStatus{
// NodeDeallocationOption: to.Ptr(armbatch.ComputeNodeDeallocationOptionRequeue),
// ResizeTimeout: to.Ptr("PT15M"),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-11T07:44:44.858Z"); return t}()),
// TargetDedicatedNodes: to.Ptr[int32](2),
// },
// ScaleSettings: &armbatch.ScaleSettings{
// FixedScale: &armbatch.FixedScaleSettings{
// ResizeTimeout: to.Ptr("PT15M"),
// TargetDedicatedNodes: to.Ptr[int32](2),
// TargetLowPriorityNodes: to.Ptr[int32](0),
// },
// },
// TaskSchedulingPolicy: &armbatch.TaskSchedulingPolicy{
// NodeFillType: to.Ptr(armbatch.ComputeNodeFillTypeSpread),
// },
// TaskSlotsPerNode: to.Ptr[int32](1),
// UpgradePolicy: &armbatch.UpgradePolicy{
// AutomaticOSUpgradePolicy: &armbatch.AutomaticOSUpgradePolicy{
// EnableAutomaticOSUpgrade: to.Ptr(true),
// },
// Mode: to.Ptr(armbatch.UpgradeModeAutomatic),
// },
// VMSize: to.Ptr("STANDARD_D4S_V3"),
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { BatchManagementClient } = require("@azure/arm-batch");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Creates a new pool inside the specified account.
*
* @summary Creates a new pool inside the specified account.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
*/
async function createPoolVirtualMachineConfigurationServiceArtifactReference() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const poolName = "testpool";
const parameters = {
deploymentConfiguration: {
virtualMachineConfiguration: {
imageReference: {
offer: "WindowsServer",
publisher: "MicrosoftWindowsServer",
sku: "2019-datacenter-smalldisk",
version: "latest",
},
nodeAgentSkuId: "batch.node.windows amd64",
serviceArtifactReference: {
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile",
},
windowsConfiguration: { enableAutomaticUpdates: false },
},
},
scaleSettings: {
fixedScale: { targetDedicatedNodes: 2, targetLowPriorityNodes: 0 },
},
upgradePolicy: {
automaticOSUpgradePolicy: { enableAutomaticOSUpgrade: true },
mode: "automatic",
},
vmSize: "Standard_d4s_v3",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.poolOperations.create(
resourceGroupName,
accountName,
poolName,
parameters,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
import com.azure.core.management.serializer.SerializerFactory;
import com.azure.core.util.serializer.SerializerEncoding;
import com.azure.resourcemanager.batch.models.ApplicationPackageReference;
import com.azure.resourcemanager.batch.models.AutoScaleSettings;
import com.azure.resourcemanager.batch.models.AutoUserScope;
import com.azure.resourcemanager.batch.models.AutoUserSpecification;
import com.azure.resourcemanager.batch.models.AutomaticOSUpgradePolicy;
import com.azure.resourcemanager.batch.models.BatchPoolIdentity;
import com.azure.resourcemanager.batch.models.CachingType;
import com.azure.resourcemanager.batch.models.CertificateReference;
import com.azure.resourcemanager.batch.models.CertificateStoreLocation;
import com.azure.resourcemanager.batch.models.CertificateVisibility;
import com.azure.resourcemanager.batch.models.CloudServiceConfiguration;
import com.azure.resourcemanager.batch.models.ComputeNodeDeallocationOption;
import com.azure.resourcemanager.batch.models.ComputeNodeFillType;
import com.azure.resourcemanager.batch.models.DataDisk;
import com.azure.resourcemanager.batch.models.DeploymentConfiguration;
import com.azure.resourcemanager.batch.models.DiffDiskPlacement;
import com.azure.resourcemanager.batch.models.DiffDiskSettings;
import com.azure.resourcemanager.batch.models.DiskEncryptionConfiguration;
import com.azure.resourcemanager.batch.models.DiskEncryptionTarget;
import com.azure.resourcemanager.batch.models.ElevationLevel;
import com.azure.resourcemanager.batch.models.EnvironmentSetting;
import com.azure.resourcemanager.batch.models.FixedScaleSettings;
import com.azure.resourcemanager.batch.models.ImageReference;
import com.azure.resourcemanager.batch.models.InboundEndpointProtocol;
import com.azure.resourcemanager.batch.models.InboundNatPool;
import com.azure.resourcemanager.batch.models.InterNodeCommunicationState;
import com.azure.resourcemanager.batch.models.IpAddressProvisioningType;
import com.azure.resourcemanager.batch.models.LinuxUserConfiguration;
import com.azure.resourcemanager.batch.models.ManagedDisk;
import com.azure.resourcemanager.batch.models.MetadataItem;
import com.azure.resourcemanager.batch.models.NetworkConfiguration;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRule;
import com.azure.resourcemanager.batch.models.NetworkSecurityGroupRuleAccess;
import com.azure.resourcemanager.batch.models.NodeCommunicationMode;
import com.azure.resourcemanager.batch.models.NodePlacementConfiguration;
import com.azure.resourcemanager.batch.models.NodePlacementPolicyType;
import com.azure.resourcemanager.batch.models.OSDisk;
import com.azure.resourcemanager.batch.models.PoolEndpointConfiguration;
import com.azure.resourcemanager.batch.models.PoolIdentityType;
import com.azure.resourcemanager.batch.models.PublicIpAddressConfiguration;
import com.azure.resourcemanager.batch.models.ResourceFile;
import com.azure.resourcemanager.batch.models.RollingUpgradePolicy;
import com.azure.resourcemanager.batch.models.ScaleSettings;
import com.azure.resourcemanager.batch.models.ServiceArtifactReference;
import com.azure.resourcemanager.batch.models.StartTask;
import com.azure.resourcemanager.batch.models.StorageAccountType;
import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy;
import com.azure.resourcemanager.batch.models.UpgradeMode;
import com.azure.resourcemanager.batch.models.UpgradePolicy;
import com.azure.resourcemanager.batch.models.UserAccount;
import com.azure.resourcemanager.batch.models.UserAssignedIdentities;
import com.azure.resourcemanager.batch.models.UserIdentity;
import com.azure.resourcemanager.batch.models.VMExtension;
import com.azure.resourcemanager.batch.models.VirtualMachineConfiguration;
import com.azure.resourcemanager.batch.models.WindowsConfiguration;
import java.io.IOException;
import java.time.Duration;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for Pool Create.
*/
public final class Main {
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_ServiceArtifactReference.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration ServiceArtifactReference.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolVirtualMachineConfigurationServiceArtifactReference(
com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2019-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withServiceArtifactReference(new ServiceArtifactReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(2).withTargetLowPriorityNodes(0)))
.withUpgradePolicy(new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)
.withAutomaticOSUpgradePolicy(new AutomaticOSUpgradePolicy().withEnableAutomaticOSUpgrade(true)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_ManagedOSDisk.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration OSDisk.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolVirtualMachineConfigurationOSDisk(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d2s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("microsoftwindowsserver")
.withOffer("windowsserver").withSku("2022-datacenter-smalldisk"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withOsDisk(new OSDisk().withCaching(CachingType.READ_WRITE)
.withManagedDisk(new ManagedDisk().withStorageAccountType(StorageAccountType.STANDARD_SSD_LRS))
.withDiskSizeGB(100).withWriteAcceleratorEnabled(false))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalCloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration()
.withCloudServiceConfiguration(new CloudServiceConfiguration().withOsFamily("5")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(3)))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_MinimalVirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Minimal VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void
createPoolMinimalVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration_Extensions.json
*/
/**
* Sample code: CreatePool - VirtualMachineConfiguration Extensions.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolVirtualMachineConfigurationExtensions(
com.azure.resourcemanager.batch.BatchManager manager) throws IOException {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("0001-com-ubuntu-server-focal").withSku("20_04-lts"))
.withNodeAgentSkuId("batch.node.ubuntu 20.04")
.withExtensions(Arrays.asList(new VMExtension().withName("batchextension1")
.withPublisher("Microsoft.Azure.KeyVault").withType("KeyVaultForLinux")
.withTypeHandlerVersion("2.0").withAutoUpgradeMinorVersion(true)
.withEnableAutomaticUpgrade(true)
.withSettings(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(
"{\"authenticationSettingsKey\":\"authenticationSettingsValue\",\"secretsManagementSettingsKey\":\"secretsManagementSettingsValue\"}",
Object.class, SerializerEncoding.JSON))))))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.withTargetNodeCommunicationMode(NodeCommunicationMode.DEFAULT).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UserAssignedIdentities
* .json
*/
/**
* Sample code: CreatePool - UserAssignedIdentities.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUserAssignedIdentities(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withIdentity(new BatchPoolIdentity().withType(PoolIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1",
new UserAssignedIdentities(),
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2",
new UserAssignedIdentities())))
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(
new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical")
.withOffer("UbuntuServer").withSku("18.04-LTS").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings().withAutoScale(new AutoScaleSettings()
.withFormula("$TargetDedicatedNodes=1").withEvaluationInterval(Duration.parse("PT5M"))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_UpgradePolicy.json
*/
/**
* Sample code: CreatePool - UpgradePolicy.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolUpgradePolicy(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2019-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(2).withTargetLowPriorityNodes(0)))
.withUpgradePolicy(
new UpgradePolicy().withMode(UpgradeMode.AUTOMATIC)
.withAutomaticOSUpgradePolicy(new AutomaticOSUpgradePolicy().withDisableAutomaticRollback(true)
.withEnableAutomaticOSUpgrade(true).withUseRollingUpgradePolicy(true)
.withOsRollingUpgradeDeferral(true))
.withRollingUpgradePolicy(new RollingUpgradePolicy().withEnableCrossZoneUpgrade(true)
.withMaxBatchInstancePercent(20).withMaxUnhealthyInstancePercent(20)
.withMaxUnhealthyUpgradedInstancePercent(20).withPauseTimeBetweenBatches("PT0S")
.withPrioritizeUnhealthyInstances(false).withRollbackFailedInstancesOnPolicyBreach(false)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_AcceleratedNetworking.
* json
*/
/**
* Sample code: CreatePool - accelerated networking.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolAcceleratedNetworking(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D1_V2")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-datacenter-smalldisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withEnableAcceleratedNetworking(true))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_VirtualMachineConfiguration.json
*/
/**
* Sample code: CreatePool - Full VirtualMachineConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullVirtualMachineConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(
new DeploymentConfiguration()
.withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("MicrosoftWindowsServer")
.withOffer("WindowsServer").withSku("2016-Datacenter-SmallDisk").withVersion("latest"))
.withNodeAgentSkuId("batch.node.windows amd64")
.withWindowsConfiguration(new WindowsConfiguration().withEnableAutomaticUpdates(false))
.withDataDisks(Arrays.asList(
new DataDisk().withLun(0).withCaching(CachingType.READ_WRITE).withDiskSizeGB(30)
.withStorageAccountType(StorageAccountType.PREMIUM_LRS),
new DataDisk().withLun(1).withCaching(CachingType.NONE).withDiskSizeGB(200)
.withStorageAccountType(StorageAccountType.STANDARD_LRS)))
.withLicenseType("Windows_Server")
.withDiskEncryptionConfiguration(new DiskEncryptionConfiguration().withTargets(
Arrays.asList(DiskEncryptionTarget.OS_DISK, DiskEncryptionTarget.TEMPORARY_DISK)))
.withNodePlacementConfiguration(
new NodePlacementConfiguration().withPolicy(NodePlacementPolicyType.ZONAL))
.withOsDisk(new OSDisk().withEphemeralOSDiskSettings(
new DiffDiskSettings().withPlacement(DiffDiskPlacement.CACHE_DISK)))))
.withScaleSettings(
new ScaleSettings()
.withAutoScale(
new AutoScaleSettings().withFormula(
"$TargetDedicatedNodes=1").withEvaluationInterval(
Duration.parse("PT5M"))))
.withNetworkConfiguration(
new NetworkConfiguration()
.withEndpointConfiguration(new PoolEndpointConfiguration().withInboundNatPools(
Arrays.asList(new InboundNatPool().withName("testnat").withProtocol(InboundEndpointProtocol.TCP)
.withBackendPort(12001).withFrontendPortRangeStart(15000).withFrontendPortRangeEnd(15100)
.withNetworkSecurityGroupRules(Arrays.asList(new NetworkSecurityGroupRule()
.withPriority(150).withAccess(NetworkSecurityGroupRuleAccess.ALLOW)
.withSourceAddressPrefix("192.100.12.45").withSourcePortRanges(Arrays.asList("1", "2")),
new NetworkSecurityGroupRule().withPriority(3500)
.withAccess(NetworkSecurityGroupRuleAccess.DENY).withSourceAddressPrefix("*")
.withSourcePortRanges(Arrays.asList("*"))))))))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_SharedImageGallery.
* json
*/
/**
* Sample code: CreatePool - Custom Image.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolCustomImage(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.create();
}
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* PoolCreate_CloudServiceConfiguration.json
*/
/**
* Sample code: CreatePool - Full CloudServiceConfiguration.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolFullCloudServiceConfiguration(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withDisplayName("my-pool-name").withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withCloudServiceConfiguration(
new CloudServiceConfiguration().withOsFamily("4").withOsVersion("WA-GUEST-OS-4.45_201708-01")))
.withScaleSettings(new ScaleSettings().withFixedScale(new FixedScaleSettings()
.withResizeTimeout(Duration.parse("PT8M")).withTargetDedicatedNodes(6).withTargetLowPriorityNodes(28)
.withNodeDeallocationOption(ComputeNodeDeallocationOption.TASK_COMPLETION)))
.withInterNodeCommunication(InterNodeCommunicationState.ENABLED)
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135",
"/subscriptions/subid2/resourceGroups/rg24/providers/Microsoft.Network/publicIPAddresses/ip268"))))
.withTaskSlotsPerNode(13)
.withTaskSchedulingPolicy(new TaskSchedulingPolicy().withNodeFillType(ComputeNodeFillType.PACK))
.withUserAccounts(Arrays.asList(new UserAccount().withName("username1").withPassword("fakeTokenPlaceholder")
.withElevationLevel(ElevationLevel.ADMIN)
.withLinuxUserConfiguration(new LinuxUserConfiguration().withUid(1234).withGid(4567)
.withSshPrivateKey("fakeTokenPlaceholder"))))
.withMetadata(Arrays.asList(new MetadataItem().withName("metadata-1").withValue("value-1"),
new MetadataItem().withName("metadata-2").withValue("value-2")))
.withStartTask(new StartTask().withCommandLine("cmd /c SET")
.withResourceFiles(Arrays.asList(
new ResourceFile().withHttpUrl("https://testaccount.blob.core.windows.net/example-blob-file")
.withFilePath("c:\\temp\\gohere").withFileMode("777")))
.withEnvironmentSettings(Arrays.asList(new EnvironmentSetting().withName("MYSET").withValue("1234")))
.withUserIdentity(new UserIdentity().withAutoUser(
new AutoUserSpecification().withScope(AutoUserScope.POOL).withElevationLevel(ElevationLevel.ADMIN)))
.withMaxTaskRetryCount(6).withWaitForSuccess(true))
.withCertificates(Arrays.asList(new CertificateReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/certificates/sha1-1234567")
.withStoreLocation(CertificateStoreLocation.LOCAL_MACHINE).withStoreName("MY")
.withVisibility(Arrays.asList(CertificateVisibility.REMOTE_USER))))
.withApplicationPackages(Arrays.asList(new ApplicationPackageReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool/applications/app_1234")
.withVersion("asdf")))
.withApplicationLicenses(Arrays.asList("app-license0", "app-license1")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_NoPublicIPAddresses.
* json
*/
/**
* Sample code: CreatePool - No public IP.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolNoPublicIP(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(
new PublicIpAddressConfiguration().withProvision(IpAddressProvisioningType.NO_PUBLIC_IPADDRESSES)))
.create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_ResourceTags.json
*/
/**
* Sample code: CreatePool - ResourceTags.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolResourceTags(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("Standard_d4s_v3")
.withDeploymentConfiguration(
new DeploymentConfiguration().withVirtualMachineConfiguration(new VirtualMachineConfiguration()
.withImageReference(new ImageReference().withPublisher("Canonical").withOffer("UbuntuServer")
.withSku("18_04-lts-gen2").withVersion("latest"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withScaleSettings(new ScaleSettings()
.withFixedScale(new FixedScaleSettings().withTargetDedicatedNodes(1).withTargetLowPriorityNodes(0)))
.withResourceTags(mapOf("TagName1", "TagValue1", "TagName2", "TagValue2")).create();
}
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PoolCreate_PublicIPs.json
*/
/**
* Sample code: CreatePool - Public IPs.
*
* @param manager Entry point to BatchManager.
*/
public static void createPoolPublicIPs(com.azure.resourcemanager.batch.BatchManager manager) {
manager.pools().define("testpool").withExistingBatchAccount("default-azurebatch-japaneast", "sampleacct")
.withVmSize("STANDARD_D4")
.withDeploymentConfiguration(new DeploymentConfiguration().withVirtualMachineConfiguration(
new VirtualMachineConfiguration().withImageReference(new ImageReference().withId(
"/subscriptions/subid/resourceGroups/networking-group/providers/Microsoft.Compute/galleries/testgallery/images/testimagedef/versions/0.0.1"))
.withNodeAgentSkuId("batch.node.ubuntu 18.04")))
.withNetworkConfiguration(new NetworkConfiguration().withSubnetId(
"/subscriptions/subid/resourceGroups/rg1234/providers/Microsoft.Network/virtualNetworks/network1234/subnets/subnet123")
.withPublicIpAddressConfiguration(new PublicIpAddressConfiguration()
.withProvision(IpAddressProvisioningType.USER_MANAGED)
.withIpAddressIds(Arrays.asList(
"/subscriptions/subid1/resourceGroups/rg13/providers/Microsoft.Network/publicIPAddresses/ip135"))))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
ETag: W/"0x8DB51F14DC1A8AD"
{
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct/pools/testpool",
"name": "mypool41",
"type": "Microsoft.Batch/batchAccounts/pools",
"etag": "W/\"0x8DB51F396992B8D\"",
"properties": {
"lastModified": "2023-05-11T07:44:44.8580493Z",
"creationTime": "2023-05-11T07:44:44.8580493Z",
"provisioningState": "Succeeded",
"provisioningStateTransitionTime": "2023-05-11T07:44:44.8580493Z",
"allocationState": "Resizing",
"allocationStateTransitionTime": "2023-05-11T07:44:44.8580493Z",
"vmSize": "STANDARD_D4S_V3",
"interNodeCommunication": "Disabled",
"taskSlotsPerNode": 1,
"taskSchedulingPolicy": {
"nodeFillType": "Spread"
},
"deploymentConfiguration": {
"virtualMachineConfiguration": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2019-datacenter-smalldisk",
"version": "latest"
},
"nodeAgentSkuId": "batch.node.windows amd64",
"windowsConfiguration": {
"enableAutomaticUpdates": false
},
"serviceArtifactReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/vmArtifactsProfile"
}
}
},
"scaleSettings": {
"fixedScale": {
"targetDedicatedNodes": 2,
"targetLowPriorityNodes": 0,
"resizeTimeout": "PT15M"
}
},
"resizeOperationStatus": {
"targetDedicatedNodes": 2,
"nodeDeallocationOption": "Requeue",
"resizeTimeout": "PT15M",
"startTime": "2023-05-11T07:44:44.8580493Z"
},
"currentDedicatedNodes": 0,
"currentLowPriorityNodes": 0,
"upgradePolicy": {
"mode": "automatic",
"automaticOSUpgradePolicy": {
"enableAutomaticOSUpgrade": true
}
}
}
}
Definíciók
Name |
Description |
AllocationState
|
Azt jelzi, hogy a készlet átméretez-e.
|
ApplicationPackageReference
|
Hivatkozás egy alkalmazáscsomagra a batch-fiókban
|
AutomaticOSUpgradePolicy
|
Az automatikus operációsrendszer-frissítés végrehajtásához használt konfigurációs paraméterek.
|
AutoScaleRun
|
A készlet automatikus skálázási képletének végrehajtásából származó eredmények és hibák.
|
AutoScaleRunError
|
Hiba történt egy készlet automatikus skálázása során.
|
AutoScaleSettings
|
A készlet automatikus skálázási beállításai.
|
AutoUserScope
|
Az automatikus felhasználó hatóköre
|
AutoUserSpecification
|
Megadja a Batch szolgáltatáson feladatot futtató automatikus felhasználó paramétereit.
|
AzureBlobFileSystemConfiguration
|
Az Azure Storage-tárolóhoz blobfuse használatával való csatlakozáshoz használt információk.
|
AzureFileShareConfiguration
|
Az Azure Fileshare-hoz való csatlakozáshoz használt információk.
|
BatchPoolIdentity
|
A Batch-készlet identitása, ha konfigurálva van. Ha a készlet identitása egy meglévő készlet frissítése során frissül, csak a készlet 0-ra zsugorítása után létrehozott új virtuális gépek rendelkeznek a frissített identitásokkal
|
CachingType
|
A lemezen engedélyezendő gyorsítótárazás típusa.
|
CertificateReference
|
Hivatkozás egy készlet számítási csomópontjaira telepíteni kívánt tanúsítványra. Ennek ugyanabban a fiókban kell lennie, mint a készletnek.
|
CertificateStoreLocation
|
A tanúsítványtároló helye azon a számítási csomóponton, amelybe telepíteni szeretné a tanúsítványt.
|
CertificateVisibility
|
A számítási csomóponton található felhasználói fiókoknak hozzáféréssel kell rendelkezniük a tanúsítvány privát adataihoz.
|
CIFSMountConfiguration
|
A CIFS-fájlrendszerhez való csatlakozáshoz használt információk.
|
CloudError
|
Hibaválasz a Batch szolgáltatástól.
|
CloudErrorBody
|
Hibaválasz a Batch szolgáltatástól.
|
CloudServiceConfiguration
|
A készletek csomópontainak konfigurációja az Azure Cloud Services platformon alapul.
|
ComputeNodeDeallocationOption
|
Meghatározza, hogy mi a teendő egy csomóponttal és annak futó tevékenységeivel, miután kiválasztotta a felszabadításhoz.
|
ComputeNodeFillType
|
Hogyan kell elosztani a feladatokat a számítási csomópontok között.
|
ComputeNodeIdentityReference
|
A számítási csomópont által használt Batch-készlethez társított felhasználó által hozzárendelt identitásra mutató hivatkozás.
|
ContainerConfiguration
|
A tárolóbarát készletek konfigurációja.
|
ContainerRegistry
|
Egy privát tárolóregisztrációs adatbázis.
|
ContainerType
|
A használandó tárolótechnológia.
|
ContainerWorkingDirectory
|
Jelölő, amely jelzi, hogy hol található a tárolófeladat munkakönyvtára. Az alapértelmezett érték a "taskWorkingDirectory".
|
DataDisk
|
A készlet számítási csomópontjaihoz társított adatlemezek által használt beállítások. Csatolt adatlemezek használatakor a virtuális gépen belülről kell csatlakoztatnia és formáznia a lemezeket a használatukhoz.
|
DeploymentConfiguration
|
Üzembehelyezési konfiguráció tulajdonságai.
|
DiffDiskPlacement
|
Megadja az operációsrendszer-lemez rövid élettartamú lemezelhelyezését a készletben lévő összes virtuális gép esetében.
|
DiffDiskSettings
|
Megadja a virtuális gép által használt operációsrendszer-lemez rövid élettartamú lemezbeállításait.
|
DiskEncryptionConfiguration
|
A készlet számítási csomópontjaira alkalmazott lemeztitkosítási konfiguráció. A lemeztitkosítási konfiguráció nem támogatott a Virtuális gép rendszerképével vagy az Azure Compute Gallery rendszerképével létrehozott Linux-készletben.
|
DiskEncryptionTarget
|
A Batch szolgáltatás titkosítja a lemezcélok listáját a számítási csomóponton
|
DynamicVNetAssignmentScope
|
A dinamikus virtuális hálózatok hozzárendelésének hatóköre.
|
ElevationLevel
|
A felhasználó jogosultságszintje.
|
EnvironmentSetting
|
Egy tevékenységfolyamathoz beállítandó környezeti változó.
|
FixedScaleSettings
|
Kijavítottuk a készlet méretezési beállításait.
|
ImageReference
|
Egy Azure Virtual Machines Marketplace-rendszerképre vagy egy egyéni virtuális gép Azure Image-erőforrására mutató hivatkozás. A Azure Batch által ellenőrzött összes imageReferences listájának lekéréséhez tekintse meg a "Támogatott csomópontügynök termékváltozatok listázása" műveletet.
|
InboundEndpointProtocol
|
A végpont protokollja.
|
InboundNatPool
|
Bejövő NAT-készlet, amely a Batch-készletben lévő számítási csomópontok adott portjainak külső kezelésére használható.
|
InterNodeCommunicationState
|
Azt jelzi, hogy a készlet engedélyezi-e a csomópontok közötti közvetlen kommunikációt.
|
IPAddressProvisioningType
|
A Batch-készlet nyilvános IP-címeinek kiépítési típusa.
|
LinuxUserConfiguration
|
A felhasználói fiók Linux-csomóponton való létrehozásához használt tulajdonságok.
|
LoginMode
|
Bejelentkezési mód a felhasználó számára
|
ManagedDisk
|
|
MetadataItem
|
Egy Batch-szolgáltatáserőforráshoz társított név-érték pár.
|
MountConfiguration
|
Az egyes csomópontokra csatlakoztatandó fájlrendszer.
|
NetworkConfiguration
|
A készlet hálózati konfigurációja.
|
NetworkSecurityGroupRule
|
Egy bejövő végpontra alkalmazandó hálózati biztonságicsoport-szabály.
|
NetworkSecurityGroupRuleAccess
|
A megadott IP-címhez, alhálózati tartományhoz vagy címkéhez végrehajtandó művelet.
|
NFSMountConfiguration
|
NFS-fájlrendszerhez való csatlakozáshoz használt információk.
|
NodeCommunicationMode
|
Meghatározza, hogy a készlet hogyan kommunikál a Batch szolgáltatással.
|
NodePlacementConfiguration
|
Csomópontelhelyezési konfiguráció kötegkészletekhez.
|
NodePlacementPolicyType
|
A készletben lévő csomópontok lefoglalására vonatkozó elhelyezési szabályzat.
|
OSDisk
|
A virtuális gép operációsrendszer-lemezének beállításai.
|
Pool
|
Készletre vonatkozó információkat tartalmaz.
|
PoolEndpointConfiguration
|
Egy készlet végpontkonfigurációja.
|
PoolIdentityType
|
A Batch-készlethez használt identitás típusa.
|
PoolProvisioningState
|
A készlet aktuális állapota.
|
PublicIPAddressConfiguration
|
A készlet hálózati konfigurációjának nyilvános IP-címkonfigurációja.
|
ResizeError
|
Hiba történt egy készlet átméretezésekor.
|
ResizeOperationStatus
|
Az aktuális vagy az utolsó befejezett átméretezési művelet részletei.
|
ResourceFile
|
Egy vagy több fájl, amely egy számítási csomópontra tölthető le.
|
RollingUpgradePolicy
|
A működés közbeni frissítés során használt konfigurációs paraméterek.
|
ScaleSettings
|
A készlet méretezési beállításai
|
SecurityProfile
|
Megadja a virtuális gép vagy a virtuálisgép-méretezési csoport biztonsági profilbeállításait.
|
SecurityTypes
|
A virtuális gép SecurityType tulajdonságát adja meg. Az UefiSettings engedélyezéséhez minden megadott értékre be kell állítani.
|
ServiceArtifactReference
|
Megadja azt a szolgáltatásösszetevő-referencia-azonosítót, amellyel a méretezési csoport összes virtuális gépéhez ugyanazt a rendszerképverziót állíthatja be a "legújabb" rendszerképverzió használatakor.
|
StartTask
|
Olyan feladat, amely akkor fut, amikor egy számítási csomópont csatlakozik egy készlethez a Azure Batch szolgáltatásban, vagy amikor a számítási csomópont újraindul vagy újra létre lesz hozva.
|
StorageAccountType
|
A tárfiók típusa adatlemezek vagy operációsrendszer-lemezek létrehozásához.
|
TaskContainerSettings
|
A feladat tárolóbeállításai.
|
TaskSchedulingPolicy
|
Meghatározza, hogy a tevékenységek hogyan legyenek elosztva a számítási csomópontok között.
|
UefiSettings
|
Megadja a virtuális gép létrehozásakor használt biztonsági beállításokat, például a biztonságos rendszerindítást és a vTPM-et.
|
UpgradeMode
|
Megadja a méretezési csoportban lévő virtuális gépekre való frissítés módját.
Lehetséges értékek:
Manuális – A méretezési csoportban lévő virtuális gépek frissítéseinek alkalmazását szabályozhatja. Ezt a manualUpgrade művelet használatával teheti meg.
Automatikus – A méretezési csoport összes virtuális gépe automatikusan frissül.
Működés közben – A méretezési csoport kötegekben hajtja végre a frissítéseket, és a szünetidő nem kötelező.
|
UpgradePolicy
|
Egy frissítési szabályzatot ír le – automatikus, manuális vagy működés közben.
|
UserAccount
|
Egy felhasználó Azure Batch csomóponton való létrehozásához használt tulajdonságok.
|
UserAssignedIdentities
|
A társított felhasználói identitások listája.
|
UserIdentity
|
Annak a felhasználói identitásnak a definíciója, amely alatt a feladat fut.
|
VirtualMachineConfiguration
|
A számítási csomópontok konfigurációja egy készletben az Azure Virtual Machines infrastruktúráján alapul.
|
VMExtension
|
A virtuálisgép-bővítmények konfigurációja.
|
WindowsConfiguration
|
A virtuális gépre alkalmazandó Windows operációsrendszer-beállítások.
|
WindowsUserConfiguration
|
A felhasználói fiók Windows-csomóponton való létrehozásához használt tulajdonságok.
|
AllocationState
Azt jelzi, hogy a készlet átméretez-e.
Name |
Típus |
Description |
Resizing
|
string
|
A készlet átméretezi a készletet; vagyis a számítási csomópontok hozzá lesznek adva a készlethez, vagy el lesznek távolítva a készletből.
|
Steady
|
string
|
A készlet nem átméreteződik. A készletben lévő csomópontok száma nem változik. Egy készlet ezt az állapotot adja meg a létrehozáskor, és amikor nem hajtanak végre műveleteket a készleten a csomópontok számának módosításához.
|
Stopping
|
string
|
A készlet átméreteződött, de a felhasználó kérte az átméretezés leállítását, de a leállítási kérés még nem fejeződött be.
|
ApplicationPackageReference
Hivatkozás egy alkalmazáscsomagra a batch-fiókban
Name |
Típus |
Description |
id
|
string
|
A telepíteni kívánt alkalmazáscsomag azonosítója. Ennek ugyanabban a kötegfiókban kell lennie, mint a készletnek. Ez lehet egy adott verzióra vagy az alapértelmezett verzióra való hivatkozás, ha létezik.
|
version
|
string
|
Az üzembe helyezendő alkalmazás verziója. Ha nincs megadva, az alapértelmezett verzió lesz üzembe helyezve.
Ha ez nincs megadva, és nincs megadva alapértelmezett verzió ehhez az alkalmazáshoz, a kérés az InvalidApplicationPackageReferences hibakóddal hiúsul meg. Ha közvetlenül a REST API-t hívja meg, a HTTP-állapotkód 409.
|
AutomaticOSUpgradePolicy
Az automatikus operációsrendszer-frissítés végrehajtásához használt konfigurációs paraméterek.
Name |
Típus |
Description |
disableAutomaticRollback
|
boolean
|
Le kell-e tiltani az operációs rendszer lemezkép-visszaállítási funkcióját.
|
enableAutomaticOSUpgrade
|
boolean
|
Azt jelzi, hogy az operációsrendszer-frissítéseket automatikusan alkalmazni kell-e a méretezési csoportok példányaira, amikor elérhetővé válik az operációsrendszer-lemezkép újabb verziója.
Ha ez igaz értékre van állítva a Windows-alapú készletek esetében, a WindowsConfiguration.enableAutomaticUpdates nem állítható igaz értékre.
|
osRollingUpgradeDeferral
|
boolean
|
Halasztja az operációsrendszer-frissítéseket a TVM-eken, ha feladatokat futtatnak.
|
useRollingUpgradePolicy
|
boolean
|
Azt jelzi, hogy a működés közbeni frissítési szabályzatot kell-e használni az automatikus operációs rendszer frissítése során. Az automatikus operációs rendszer frissítése visszaáll az alapértelmezett szabályzatra, ha a VMSS-en nincs meghatározva szabályzat.
|
AutoScaleRun
A készlet automatikus skálázási képletének végrehajtásából származó eredmények és hibák.
Name |
Típus |
Description |
error
|
AutoScaleRunError
|
A készlet automatikus skálázási képletének kiértékelésekor észlelt hiba részletei, ha a kiértékelés sikertelen volt.
|
evaluationTime
|
string
|
Az automatikus skálázási képlet utolsó kiértékelésének időpontja.
|
results
|
string
|
Az automatikus skálázási képlet kiértékelése során használt összes változó végső értékei.
A rendszer minden változóértéket $variable=érték formában ad vissza, a változókat pedig pontosvesszővel választja el egymástól.
|
AutoScaleRunError
Hiba történt egy készlet automatikus skálázása során.
Name |
Típus |
Description |
code
|
string
|
A hiba azonosítója. A kódok invariánsak, és programozott módon használhatók.
|
details
|
AutoScaleRunError[]
|
A hibával kapcsolatos további részletek.
|
message
|
string
|
A hibát leíró üzenet, amely alkalmas a felhasználói felületen való megjelenítésre.
|
AutoScaleSettings
A készlet automatikus skálázási beállításai.
Name |
Típus |
Description |
evaluationInterval
|
string
|
Az az időintervallum, amikor automatikusan módosítani szeretné a készlet méretét az automatikus skálázási képletnek megfelelően.
Ha nincs megadva, az alapértelmezett érték 15 perc (PT15M).
|
formula
|
string
|
A készletben található számítási csomópontok kívánt számának képlete.
|
AutoUserScope
Az automatikus felhasználó hatóköre
Name |
Típus |
Description |
Pool
|
string
|
Meghatározza, hogy a feladat a készlet minden csomópontján létrehozott közös automatikus felhasználói fiókként fusson.
|
Task
|
string
|
Meghatározza, hogy a szolgáltatásnak új felhasználót kell létrehoznia a feladathoz.
|
AutoUserSpecification
Megadja a Batch szolgáltatáson feladatot futtató automatikus felhasználó paramétereit.
Name |
Típus |
Description |
elevationLevel
|
ElevationLevel
|
Az automatikus felhasználó jogosultságszintje.
Az alapértelmezett érték a nonAdmin.
|
scope
|
AutoUserScope
|
Az automatikus felhasználó hatóköre
Az alapértelmezett érték a Készlet. Ha a készlet Windows rendszert futtat, a Tevékenység értéket kell megadni, ha szigorúbb elkülönítésre van szükség a tevékenységek között. Ha például a feladat úgy mutálja a beállításjegyzéket, hogy az hatással lehet más tevékenységekre, vagy olyan tanúsítványokat adott meg a készletben, amelyeknek nem szabad a normál tevékenységek számára akadálymentesnek lenniük, de az indítási tevékenységeknek elérhetőnek kell lenniük.
|
AzureBlobFileSystemConfiguration
Az Azure Storage-tárolóhoz blobfuse használatával való csatlakozáshoz használt információk.
Name |
Típus |
Description |
accountKey
|
string
|
Az Azure Storage-fiók kulcsa.
Ez a tulajdonság kölcsönösen kizárja mind a sasKey, mind az identitás; pontosan egyet kell megadni.
|
accountName
|
string
|
Az Azure Storage-fiók neve.
|
blobfuseOptions
|
string
|
További parancssori beállítások a csatlakoztatási parancsnak való továbbításhoz.
Ezek a windowsos "net use" és a linuxos "csatlakoztatási" lehetőségek.
|
containerName
|
string
|
A Azure Blob Storage tároló neve.
|
identityReference
|
ComputeNodeIdentityReference
|
A containerName eléréséhez használandó felhasználó által hozzárendelt identitásra mutató hivatkozás
Ez a tulajdonság kölcsönösen kizárja az accountKey és a sasKey tulajdonságot; pontosan egyet kell megadni.
|
relativeMountPath
|
string
|
A relatív elérési út azon a számítási csomóponton, amelyen a fájlrendszer csatlakoztatva lesz
Az összes fájlrendszer a Batch csatlakoztatási könyvtárához képest van csatlakoztatva, amely a AZ_BATCH_NODE_MOUNTS_DIR környezeti változón keresztül érhető el.
|
sasKey
|
string
|
Az Azure Storage SAS-jogkivonata.
Ez a tulajdonság kölcsönösen kizárja az accountKey és az identitás használatát; pontosan egyet kell megadni.
|
AzureFileShareConfiguration
Az Azure Fileshare-hoz való csatlakozáshoz használt információk.
Name |
Típus |
Description |
accountKey
|
string
|
Az Azure Storage-fiók kulcsa.
|
accountName
|
string
|
Az Azure Storage-fiók neve.
|
azureFileUrl
|
string
|
A Azure Files URL-címe.
Ez a "https://{account}.file.core.windows.net/" formátumú.
|
mountOptions
|
string
|
További parancssori beállítások a csatlakoztatási parancsnak való továbbításhoz.
Ezek a windowsos "net use" és a linuxos "csatlakoztatási" lehetőségek.
|
relativeMountPath
|
string
|
A relatív elérési út azon a számítási csomóponton, amelyen a fájlrendszer csatlakoztatva lesz
Az összes fájlrendszer a Batch csatlakoztatási könyvtárához képest van csatlakoztatva, amely a AZ_BATCH_NODE_MOUNTS_DIR környezeti változón keresztül érhető el.
|
BatchPoolIdentity
A Batch-készlet identitása, ha konfigurálva van. Ha a készlet identitása egy meglévő készlet frissítése során frissül, csak a készlet 0-ra zsugorítása után létrehozott új virtuális gépek rendelkeznek a frissített identitásokkal
Name |
Típus |
Description |
type
|
PoolIdentityType
|
A Batch-készlethez használt identitás típusa.
|
userAssignedIdentities
|
object
|
A Batch-készlethez társított felhasználói identitások listája.
|
CachingType
A lemezen engedélyezendő gyorsítótárazás típusa.
Name |
Típus |
Description |
None
|
string
|
A lemez gyorsítótárazási módja nincs engedélyezve.
|
ReadOnly
|
string
|
A lemez gyorsítótárazási módja csak olvasható.
|
ReadWrite
|
string
|
A lemez gyorsítótárazási módja olvasási és írási.
|
CertificateReference
Hivatkozás egy készlet számítási csomópontjaira telepíteni kívánt tanúsítványra. Ennek ugyanabban a fiókban kell lennie, mint a készletnek.
Name |
Típus |
Description |
id
|
string
|
A készletre telepítendő tanúsítvány teljes azonosítója. Ennek ugyanabban a kötegfiókban kell lennie, mint a készletnek.
|
storeLocation
|
CertificateStoreLocation
|
A tanúsítványtároló helye azon a számítási csomóponton, amelybe telepíteni szeretné a tanúsítványt.
Az alapértelmezett érték a currentUser. Ez a tulajdonság csak a Windows-csomópontokkal konfigurált készletekre vonatkozik (azaz a cloudServiceConfiguration szolgáltatással vagy a virtualMachineConfiguration használatával, Windows rendszerkép-referencia használatával). Linux számítási csomópontok esetén a tanúsítványok a feladat munkakönyvtárában található könyvtárban vannak tárolva, és a rendszer egy környezeti változót AZ_BATCH_CERTIFICATES_DIR a feladatnak a hely lekérdezéséhez. A "remoteUser" láthatóságú tanúsítványok esetében a rendszer létrehoz egy "tanúsítvány" könyvtárat a felhasználó kezdőkönyvtárában (például /home/{user-name}/certs), és a tanúsítványok ebben a könyvtárban vannak elhelyezve.
|
storeName
|
string
|
Annak a számítási csomópontnak a tanúsítványtárolója, amelybe telepíteni szeretné a tanúsítványt.
Ez a tulajdonság csak a Windows-csomópontokkal konfigurált készletekre vonatkozik (azaz a cloudServiceConfiguration használatával vagy a virtualMachineConfiguration használatával, Windows rendszerkép-referencia használatával). Az áruházak gyakori nevei a következők: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, AddressBook, de bármilyen egyéni tárolónév is használható. Az alapértelmezett érték a Saját.
|
visibility
|
CertificateVisibility[]
|
A számítási csomóponton található felhasználói fiókoknak hozzáféréssel kell rendelkezniük a tanúsítvány privát adataihoz.
|
CertificateStoreLocation
A tanúsítványtároló helye azon a számítási csomóponton, amelybe telepíteni szeretné a tanúsítványt.
Name |
Típus |
Description |
CurrentUser
|
string
|
A tanúsítványokat telepíteni kell az CurrentUser tanúsítványtárolóba.
|
LocalMachine
|
string
|
A tanúsítványokat telepíteni kell a LocalMachine tanúsítványtárolóba.
|
CertificateVisibility
A számítási csomóponton található felhasználói fiókoknak hozzáféréssel kell rendelkezniük a tanúsítvány privát adataihoz.
Name |
Típus |
Description |
RemoteUser
|
string
|
A tanúsítványnak láthatónak kell lennie azon felhasználói fiókok számára, amelyek alatt a felhasználók távolról érik el a csomópontot.
|
StartTask
|
string
|
A tanúsítványnak láthatónak kell lennie annak a felhasználói fióknak, amely alatt az indítási feladat fut. Vegye figyelembe, hogy ha az Automatikus felhasználói hatókör készlet a StartTaskhoz és egy tevékenységhez is, akkor ez a tanúsítvány a tevékenység számára is látható lesz.
|
Task
|
string
|
A tanúsítványnak láthatónak kell lennie azon felhasználói fiókok számára, amelyeken a feladatfeladatok futnak.
|
CIFSMountConfiguration
A CIFS-fájlrendszerhez való csatlakozáshoz használt információk.
Name |
Típus |
Description |
mountOptions
|
string
|
További parancssori beállítások a csatlakoztatási parancsnak való továbbításhoz.
Ezek a windowsos "net use" és a linuxos "csatlakoztatási" lehetőségek.
|
password
|
string
|
A CIFS fájlrendszeren való hitelesítéshez használandó jelszó.
|
relativeMountPath
|
string
|
A relatív elérési út azon a számítási csomóponton, amelyen a fájlrendszer csatlakoztatva lesz
Az összes fájlrendszer a Batch csatlakoztatási könyvtárához képest van csatlakoztatva, amely a AZ_BATCH_NODE_MOUNTS_DIR környezeti változón keresztül érhető el.
|
source
|
string
|
A csatlakoztatni kívánt fájlrendszer URI-ja.
|
userName
|
string
|
A CIFS fájlrendszeren való hitelesítéshez használni kívánt felhasználó.
|
CloudError
Hibaválasz a Batch szolgáltatástól.
Name |
Típus |
Description |
error
|
CloudErrorBody
|
A hibaválasz törzse.
|
CloudErrorBody
Hibaválasz a Batch szolgáltatástól.
Name |
Típus |
Description |
code
|
string
|
A hiba azonosítója. A kódok invariánsak, és programozott módon használhatók.
|
details
|
CloudErrorBody[]
|
A hibával kapcsolatos további részletek listája.
|
message
|
string
|
A hibát leíró üzenet, amely alkalmas a felhasználói felületen való megjelenítésre.
|
target
|
string
|
Az adott hiba célja. Például a hibás tulajdonság neve.
|
CloudServiceConfiguration
A készletek csomópontainak konfigurációja az Azure Cloud Services platformon alapul.
Name |
Típus |
Description |
osFamily
|
string
|
A készletben lévő virtuális gépekre telepíteni kívánt Azure Guest OS-család.
Lehetséges értékek: 2 – Os Family 2, egyenértékű a Windows Server 2008 R2 SP1 rendszerrel. 3 – Operációsrendszer-család 3, egyenértékű a Windows Server 2012. 4 – Os Family 4, egyenértékű az Windows Server 2012 R2-nek. 5 – Os Family 5, egyenértékű a Windows Server 2016. 6 – Os Family 6, egyenértékű a Windows Server 2019 rendszerrel. További információ: Azure Guest OS Releases (Azure Guest OS Releases(https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases).
|
osVersion
|
string
|
A készletben lévő virtuális gépekre telepíteni kívánt Azure-vendég operációs rendszer verziója.
Az alapértelmezett érték * , amely a megadott operációsrendszer-család legújabb operációsrendszer-verzióját adja meg.
|
ComputeNodeDeallocationOption
Meghatározza, hogy mi a teendő egy csomóponttal és annak futó tevékenységeivel, miután kiválasztotta a felszabadításhoz.
Name |
Típus |
Description |
Requeue
|
string
|
Állítsa le a futó feladatfolyamatokat, és állítsa le újra a feladatokat. A feladatok újra futni fognak, ha egy csomópont elérhető. A tevékenységek leállása után azonnal távolítsa el a csomópontokat.
|
RetainedData
|
string
|
Engedélyezze a jelenleg futó tevékenységek befejezését, majd várja meg, amíg az összes tevékenységadat-megőrzési időszak lejár. Várakozás közben ne ütemezzen új feladatokat. Távolítsa el a csomópontokat, ha az összes tevékenységmegőrzési időszak lejárt.
|
TaskCompletion
|
string
|
A jelenleg futó tevékenységek végrehajtásának engedélyezése. Várakozás közben ne ütemezzen új feladatokat. Távolítsa el a csomópontokat, ha az összes tevékenység befejeződött.
|
Terminate
|
string
|
Állítsa le a futó feladatokat. A feladatok a failureInfo hibával fejeződnek be, jelezve, hogy leálltak, és nem futnak újra. A tevékenységek leállása után azonnal távolítsa el a csomópontokat.
|
ComputeNodeFillType
Hogyan kell elosztani a feladatokat a számítási csomópontok között.
Name |
Típus |
Description |
Pack
|
string
|
A lehető legtöbb tevékenységet (taskSlotsPerNode) hozzá kell rendelni a készlet minden csomópontjára, mielőtt a készlet következő csomópontjára bármilyen tevékenységet hozzárendelne.
|
Spread
|
string
|
A tevékenységeket egyenletesen kell hozzárendelni a készlet összes csomópontja között.
|
ComputeNodeIdentityReference
A számítási csomópont által használt Batch-készlethez társított felhasználó által hozzárendelt identitásra mutató hivatkozás.
Name |
Típus |
Description |
resourceId
|
string
|
A felhasználó által hozzárendelt identitás ARM-erőforrás-azonosítója.
|
ContainerConfiguration
A tárolóbarát készletek konfigurációja.
Name |
Típus |
Description |
containerImageNames
|
string[]
|
A tárolórendszerképek nevének gyűjteménye.
Ez a teljes rendszerkép-hivatkozás, ahogyan a "docker pull" esetében meg van adva. A rendszerképek az alapértelmezett Docker-beállításjegyzékből lesznek származtatva, kivéve, ha a rendszerkép teljes mértékben egy alternatív beállításjegyzékkel rendelkezik.
|
containerRegistries
|
ContainerRegistry[]
|
További privát regisztrációs adatbázisok, amelyekből a tárolók lekértek.
Ha a rendszerképeket egy olyan privát beállításjegyzékből kell letölteni, amelyhez hitelesítő adatok szükségesek, akkor ezeket a hitelesítő adatokat itt kell megadni.
|
type
|
ContainerType
|
A használandó tárolótechnológia.
|
ContainerRegistry
Egy privát tárolóregisztrációs adatbázis.
Name |
Típus |
Description |
identityReference
|
ComputeNodeIdentityReference
|
A felhasználó által hozzárendelt identitásra való hivatkozás, a felhasználónév és a jelszó helyett egy Azure Container Registry eléréséhez.
A számítási csomópont által használt Batch-készlethez társított felhasználó által hozzárendelt identitásra mutató hivatkozás.
|
password
|
string
|
A beállításjegyzék-kiszolgálóra való bejelentkezéshez megadott jelszó.
|
registryServer
|
string
|
A beállításjegyzék URL-címe.
Ha nincs megadva, az alapértelmezett érték a "docker.io".
|
username
|
string
|
A beállításjegyzék-kiszolgálóra való bejelentkezéshez megadott felhasználónév.
|
ContainerType
A használandó tárolótechnológia.
Name |
Típus |
Description |
CriCompatible
|
string
|
A tárolók indításához CRI-alapú technológiát használunk.
|
DockerCompatible
|
string
|
A tárolók elindításához Docker-kompatibilis tárolótechnológiát használunk.
|
ContainerWorkingDirectory
Jelölő, amely jelzi, hogy hol található a tárolófeladat munkakönyvtára. Az alapértelmezett érték a "taskWorkingDirectory".
Name |
Típus |
Description |
ContainerImageDefault
|
string
|
Tárolórendszerkép által definiált munkakönyvtár használata. Ne feledje, hogy ez a könyvtár nem tartalmazza a Batch által letöltött erőforrásfájlokat.
|
TaskWorkingDirectory
|
string
|
Használja a Batch szolgáltatás szokásos munkakönyvtárát, amely a Batch által feltöltött tevékenység-erőforrásfájlokat fogja tartalmazni.
|
DataDisk
A készlet számítási csomópontjaihoz társított adatlemezek által használt beállítások. Csatolt adatlemezek használatakor a virtuális gépen belülről kell csatlakoztatnia és formáznia a lemezeket a használatukhoz.
Name |
Típus |
Description |
caching
|
CachingType
|
Az adatlemezeken engedélyezendő gyorsítótárazás típusa.
Az értékek a következők:
none – A lemez gyorsítótárazási módja nincs engedélyezve.
readOnly – A lemez gyorsítótárazási módja csak olvasható.
readWrite – A lemez gyorsítótárazási módja olvasási és írási.
A gyorsítótárazás alapértelmezett értéke nincs. A gyorsítótárazási beállításokkal kapcsolatos információkért lásd: https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/.
|
diskSizeGB
|
integer
|
A kezdeti lemezméret GB-ban az új adatlemez létrehozásakor.
|
lun
|
integer
|
A logikai egység száma.
A lun az egyes adatlemezek egyedi azonosítására szolgál. Ha több lemezt csatol, mindegyiknek külön lun-nak kell lennie. Az értéknek 0 és 63 közé kell esnie, a értéket is beleértve.
|
storageAccountType
|
StorageAccountType
|
Az adatlemezhez használandó tárfiók típusa.
Ha nincs megadva, az alapértelmezett érték a "Standard_LRS". Az értékek a következők:
Standard_LRS – Az adatlemeznek szabványos helyileg redundáns tárolást kell használnia.
Premium_LRS – Az adatlemeznek prémium helyileg redundáns tárolást kell használnia.
|
DeploymentConfiguration
Üzembehelyezési konfiguráció tulajdonságai.
Name |
Típus |
Description |
cloudServiceConfiguration
|
CloudServiceConfiguration
|
A készlet felhőszolgáltatás-konfigurációja.
Ez a tulajdonság és a virtualMachineConfiguration kölcsönösen kizáróak, és meg kell adni az egyik tulajdonságot. Ez a tulajdonság nem adható meg, ha a Batch-fiók a poolAllocationMode tulajdonságának "UserSubscription" értékre van állítva.
|
virtualMachineConfiguration
|
VirtualMachineConfiguration
|
A készlet virtuálisgép-konfigurációja.
Ez a tulajdonság és a cloudServiceConfiguration kölcsönösen kizárja egymást, és meg kell adni az egyik tulajdonságot.
|
DiffDiskPlacement
Megadja az operációsrendszer-lemez rövid élettartamú lemezelhelyezését a készletben lévő összes virtuális gép esetében.
Name |
Típus |
Description |
CacheDisk
|
string
|
A rövid élettartamú operációsrendszer-lemez a virtuálisgép-gyorsítótárban van tárolva.
|
DiffDiskSettings
Megadja a virtuális gép által használt operációsrendszer-lemez rövid élettartamú lemezbeállításait.
DiskEncryptionConfiguration
A készlet számítási csomópontjaira alkalmazott lemeztitkosítási konfiguráció. A lemeztitkosítási konfiguráció nem támogatott a Virtuális gép rendszerképével vagy az Azure Compute Gallery rendszerképével létrehozott Linux-készletben.
Name |
Típus |
Description |
targets
|
DiskEncryptionTarget[]
|
A Batch szolgáltatás titkosítja a lemezcélok listáját a számítási csomóponton
Linux-készleten csak a "TemporaryDisk" támogatott; A Windows-készletben meg kell adni az "OsDisk" és a "TemporaryDisk" értéket.
|
DiskEncryptionTarget
A Batch szolgáltatás titkosítja a lemezcélok listáját a számítási csomóponton
Name |
Típus |
Description |
OsDisk
|
string
|
A számítási csomópont operációsrendszer-lemeze titkosítva van.
|
TemporaryDisk
|
string
|
A számítási csomópont ideiglenes lemeze titkosítva van. Linux rendszeren ez a titkosítás más partíciókra (például a csatlakoztatott adatlemezeken lévőkre) vonatkozik, ha a titkosítás a rendszerindításkor történik.
|
DynamicVNetAssignmentScope
A dinamikus virtuális hálózatok hozzárendelésének hatóköre.
Name |
Típus |
Description |
job
|
string
|
A dinamikus virtuális hálózatok hozzárendelése feladatonként történik. Ha ez az érték be van állítva, a hálózati konfigurációs alhálózat azonosítóját is be kell állítani. Ez a funkció használat előtt jóváhagyást igényel. Forduljon az ügyfélszolgálathoz
|
none
|
string
|
Nincs engedélyezve dinamikus virtuális hálózat-hozzárendelés.
|
ElevationLevel
A felhasználó jogosultságszintje.
Name |
Típus |
Description |
Admin
|
string
|
A felhasználó emelt szintű hozzáféréssel rendelkező felhasználó, és teljes rendszergazdai engedélyekkel rendelkezik.
|
NonAdmin
|
string
|
A felhasználó egy általános jogú, emelt szintű hozzáféréssel nem rendelkező felhasználó.
|
EnvironmentSetting
Egy tevékenységfolyamathoz beállítandó környezeti változó.
Name |
Típus |
Description |
name
|
string
|
A környezeti változó neve.
|
value
|
string
|
A környezeti változó értéke.
|
FixedScaleSettings
Kijavítottuk a készlet méretezési beállításait.
Name |
Típus |
Alapértelmezett érték |
Description |
nodeDeallocationOption
|
ComputeNodeDeallocationOption
|
|
Meghatározza, hogy mi a teendő egy csomóponttal és annak futó tevékenységeivel, ha a készlet mérete csökken.
Ha nincs megadva, az alapértelmezett érték a Requeue.
|
resizeTimeout
|
string
|
PT15M
|
A számítási csomópontok készlethez való lefoglalásának időtúllépése.
Az alapértelmezett érték 15 perc. Az időtúllépési értékek ISO 8601 formátumot használnak. Használja például a PT10M-et 10 percig. A minimális érték 5 perc. Ha 5 percnél rövidebb értéket ad meg, a Batch szolgáltatás hibaüzenettel utasítja el a kérést; Ha közvetlenül a REST API-t hívja meg, a HTTP-állapotkód 400 (hibás kérés).
|
targetDedicatedNodes
|
integer
|
|
A készletben található dedikált számítási csomópontok kívánt száma.
A targetDedicatedNodes legalább egyikét be kell állítania a targetLowPriorityNodes értékre.
|
targetLowPriorityNodes
|
integer
|
|
A készletben lévő kihasználatlan/alacsony prioritású számítási csomópontok kívánt száma.
A targetDedicatedNodes legalább egyikét be kell állítania a targetLowPriorityNodes értékre.
|
ImageReference
Egy Azure Virtual Machines Marketplace-rendszerképre vagy egy egyéni virtuális gép Azure Image-erőforrására mutató hivatkozás. A Azure Batch által ellenőrzött összes imageReferences listájának lekéréséhez tekintse meg a "Támogatott csomópontügynök termékváltozatok listázása" műveletet.
Name |
Típus |
Description |
id
|
string
|
Az Azure Compute Gallery rendszerképének ARM-erőforrásazonosítója. A készlet számítási csomópontjai ezzel a rendszerkép-azonosítóval jönnek létre. Ez a következő formában érhető el: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/gallerys/{galleryName}/images/{imageDefinitionName}/versions/{versionId}.
Ez a tulajdonság kölcsönösen kizárja a többi tulajdonságot. Az Azure Compute-katalógus rendszerképének replikáinak ugyanabban a régióban kell lenniük, mint a Azure Batch-fióknak. A Batch-csomópontügynök és a Batch szolgáltatás közötti kommunikáció tűzfalbeállításaival kapcsolatos információkért lásd: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration.
|
offer
|
string
|
Az Azure Virtual Machines Marketplace-rendszerkép ajánlattípusa.
Például: UbuntuServer vagy WindowsServer.
|
publisher
|
string
|
Az Azure Virtual Machines Marketplace-rendszerkép közzétevője.
Például: Canonical vagy MicrosoftWindowsServer.
|
sku
|
string
|
Az Azure Virtual Machines Marketplace-rendszerkép termékváltozata.
Például: 18.04-LTS vagy 2022-datacenter.
|
version
|
string
|
Az Azure Virtual Machines Marketplace-rendszerkép verziója.
A rendszerkép legújabb verziójának kiválasztásához megadható a "latest" (legújabb) érték. Ha nincs megadva, az alapértelmezett érték a "latest".
|
InboundEndpointProtocol
A végpont protokollja.
Name |
Típus |
Description |
TCP
|
string
|
Használja a TCP-t a végponthoz.
|
UDP
|
string
|
Használja az UDP-t a végponthoz.
|
InboundNatPool
Bejövő NAT-készlet, amely a Batch-készletben lévő számítási csomópontok adott portjainak külső kezelésére használható.
Name |
Típus |
Description |
backendPort
|
integer
|
A számítási csomópont portszáma.
Ennek egyedinek kell lennie egy Batch-készleten belül. Az elfogadható értékek 1 és 65535 között vannak, kivéve a 22, 3389, 29876 és 29877 értéket, mivel ezek fenntartottak. Ha a rendszer fenntartott értékeket ad meg, a kérés a 400-ás HTTP-állapotkóddal meghiúsul.
|
frontendPortRangeEnd
|
integer
|
A külső portok tartományának utolsó portszáma, amely az egyes számítási csomópontok háttérjelentéséhez való bejövő hozzáférés biztosítására szolgál.
Az elfogadható értékek 1 és 65534 között mozognak, kivéve az 50000 és 55000 közötti portokat, amelyeket a Batch szolgáltatás foglal le. A készleten belüli összes tartománynak eltérőnek kell lennie, és nem lehet átfedésben. Ha a rendszer fenntartott vagy átfedésben lévő értékeket ad meg, a kérés a 400-ás HTTP-állapotkóddal meghiúsul.
|
frontendPortRangeStart
|
integer
|
A külső portok tartományának első portszáma, amely az egyes számítási csomópontok háttérportjához való bejövő hozzáférés biztosítására szolgál.
Az elfogadható értékek 1 és 65534 között mozognak, kivéve az 50000 és 55000 közötti, fenntartott portokat. A készleten belüli összes tartománynak eltérőnek kell lennie, és nem lehet átfedésben. Ha a rendszer fenntartott vagy átfedésben lévő értékeket ad meg, a kérés a 400-ás HTTP-állapotkóddal meghiúsul.
|
name
|
string
|
A végpont neve.
A névnek egyedinek kell lennie egy Batch-készletben, betűket, számokat, aláhúzásjeleket, pontokat és kötőjeleket tartalmazhat. A neveknek betűvel vagy számmal kell kezdődniük, betűvel, számmal vagy aláhúzásjellel kell végződniük, és nem haladhatja meg a 77 karaktert. Ha érvénytelen értékeket ad meg, a kérés a 400-ás HTTP-állapotkóddal meghiúsul.
|
networkSecurityGroupRules
|
NetworkSecurityGroupRule[]
|
A végpontra alkalmazott hálózati biztonsági csoportszabályok listája.
A Batch-készlet összes végpontján megadható szabályok maximális száma 25. Ha nincs megadva hálózati biztonságicsoport-szabály, a rendszer létrehoz egy alapértelmezett szabályt, amely engedélyezi a bejövő hozzáférést a megadott háttérjelentéshez. Ha túllépi a hálózati biztonságicsoport-szabályok maximális számát, a kérés a 400-es HTTP-állapotkóddal meghiúsul.
|
protocol
|
InboundEndpointProtocol
|
A végpont protokollja.
|
InterNodeCommunicationState
Azt jelzi, hogy a készlet engedélyezi-e a csomópontok közötti közvetlen kommunikációt.
Name |
Típus |
Description |
Disabled
|
string
|
Tiltsa le a virtuális gépek közötti hálózati kommunikációt.
|
Enabled
|
string
|
Engedélyezze a virtuális gépek közötti hálózati kommunikációt.
|
IPAddressProvisioningType
A Batch-készlet nyilvános IP-címeinek kiépítési típusa.
Name |
Típus |
Description |
BatchManaged
|
string
|
A Batch létrehoz és felügyel egy nyilvános IP-címet. A készlet méretétől függően több nyilvános IP-cím is lehet.
|
NoPublicIPAddresses
|
string
|
A készlet számítási csomópontjaihoz nem jön létre nyilvános IP-cím.
|
UserManaged
|
string
|
A nyilvános IP-címeket a felhasználó biztosítja, és a számítási csomópontok kiépítésére lesznek felhasználva.
|
LinuxUserConfiguration
A felhasználói fiók Linux-csomóponton való létrehozásához használt tulajdonságok.
Name |
Típus |
Description |
gid
|
integer
|
A felhasználói fiók csoportazonosítója.
Az uid és a gid tulajdonságokat együtt kell megadni, vagy egyáltalán nem. Ha nincs megadva, a mögöttes operációs rendszer választja ki a gid-t.
|
sshPrivateKey
|
string
|
A felhasználói fiók SSH-titkos kulcsa.
A titkos kulcs nem lehet jelszóval védett. A titkos kulcs használatával automatikusan konfigurálható aszimmetrikus kulcson alapuló hitelesítés egy Linux-készlet csomópontjai között, ha a készlet enableInterNodeCommunication tulajdonsága igaz (a rendszer figyelmen kívül hagyja, ha az enableInterNodeCommunication hamis). Ezt úgy teszi meg, hogy a kulcspárt a felhasználó .ssh könyvtárába helyezi. Ha nincs megadva, a jelszó nélküli SSH nincs konfigurálva a csomópontok között (a felhasználó .ssh könyvtárának módosítása nem történik meg).
|
uid
|
integer
|
A felhasználói fiók felhasználói azonosítója.
Az uid és a gid tulajdonságokat együtt kell megadni, vagy egyáltalán nem. Ha nincs megadva, a mögöttes operációs rendszer választja ki az uid azonosítót.
|
LoginMode
Bejelentkezési mód a felhasználó számára
Name |
Típus |
Description |
Batch
|
string
|
A LOGON32_LOGON_BATCH Win32 bejelentkezési mód. A kötegelt bejelentkezési mód hosszú ideig futó párhuzamos folyamatokhoz ajánlott.
|
Interactive
|
string
|
A LOGON32_LOGON_INTERACTIVE Win32 bejelentkezési mód. Egyes alkalmazásokhoz az interaktív bejelentkezési módhoz társított engedélyek szükségesek. Ha ez a helyzet a feladatban használt alkalmazás esetében, akkor ez a beállítás ajánlott.
|
ManagedDisk
Name |
Típus |
Description |
storageAccountType
|
StorageAccountType
|
A felügyelt lemez tárfióktípusa.
|
Egy Batch-szolgáltatáserőforráshoz társított név-érték pár.
Name |
Típus |
Description |
name
|
string
|
A metaadatelem neve.
|
value
|
string
|
A metaadatelem értéke.
|
MountConfiguration
Az egyes csomópontokra csatlakoztatandó fájlrendszer.
Name |
Típus |
Description |
azureBlobFileSystemConfiguration
|
AzureBlobFileSystemConfiguration
|
Az Egyes csomópontokon blob FUSE használatával csatlakoztatandó Azure Storage-tároló.
Ez a tulajdonság kölcsönösen kizárja az összes többi tulajdonságot.
|
azureFileShareConfiguration
|
AzureFileShareConfiguration
|
Az egyes csomópontokra csatlakoztatni kívánt Azure-fájlmegosztás.
Ez a tulajdonság kölcsönösen kizárja az összes többi tulajdonságot.
|
cifsMountConfiguration
|
CIFSMountConfiguration
|
Az egyes csomópontokra csatlakoztatni kívánt CIFS/SMB fájlrendszer.
Ez a tulajdonság kölcsönösen kizárja az összes többi tulajdonságot.
|
nfsMountConfiguration
|
NFSMountConfiguration
|
Az egyes csomópontokra csatlakoztatni kívánt NFS-fájlrendszer.
Ez a tulajdonság kölcsönösen kizárja az összes többi tulajdonságot.
|
NetworkConfiguration
A készlet hálózati konfigurációja.
Name |
Típus |
Alapértelmezett érték |
Description |
dynamicVnetAssignmentScope
|
DynamicVNetAssignmentScope
|
none
|
A dinamikus virtuális hálózatok hozzárendelésének hatóköre.
|
enableAcceleratedNetworking
|
boolean
|
|
A készletnek engedélyeznie kell-e a gyorsított hálózatkezelést.
A gyorsított hálózatkezelés lehetővé teszi az egygyökerű I/O-virtualizálást (SR-IOV) egy virtuális gépre, ami jobb hálózati teljesítményt eredményezhet. További információ: https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview.
|
endpointConfiguration
|
PoolEndpointConfiguration
|
|
A Batch-készlet számítási csomópontjaihoz tartozó végpontok konfigurációja.
A készletvégpont konfigurációja csak a virtualMachineConfiguration tulajdonsággal rendelkező készleteken támogatott.
|
publicIPAddressConfiguration
|
PublicIPAddressConfiguration
|
|
A Batch-készlet számítási csomópontjaihoz tartozó nyilvános IPAddress-konfiguráció.
Ez a tulajdonság csak a virtualMachineConfiguration tulajdonsággal rendelkező készletekben támogatott.
|
subnetId
|
string
|
|
Annak a virtuális hálózati alhálózatnak az ARM-erőforrás-azonosítója, amelyhez a készlet számítási csomópontjai csatlakoznak. Ez az űrlap /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}.
A virtuális hálózatnak ugyanabban a régióban és előfizetésben kell lennie, mint a Azure Batch-fióknak. A megadott alhálózatnak elegendő szabad IP-címmel kell rendelkeznie a készletben lévő csomópontok számának kezeléséhez. Ha az alhálózat nem rendelkezik elegendő ingyenes IP-címmel, a készlet részlegesen lefoglalja a számítási csomópontokat, és átméretezi a hibát. A "MicrosoftAzureBatch" szolgáltatásnévnek rendelkeznie kell a "Klasszikus virtuálisgép-közreműködő" Role-Based Access Control (RBAC) szerepkörrel a megadott virtuális hálózathoz. A megadott alhálózatnak engedélyeznie kell a Azure Batch szolgáltatástól érkező kommunikációt, hogy feladatokat ütemezhessen a számítási csomópontokon. Ennek ellenőrzéséhez ellenőrizze, hogy a megadott virtuális hálózat rendelkezik-e társított hálózati biztonsági csoportokkal (NSG). Ha a megadott alhálózaton lévő számítási csomópontokkal való kommunikációt egy NSG megtagadja, akkor a Batch szolgáltatás használhatatlanra állítja a számítási csomópontok állapotát. Ha a megadott virtuális hálózathoz társított hálózati biztonsági csoportok (NSG) találhatók, néhány fenntartott portot engedélyezni kell a bejövő kommunikációhoz. A virtuálisgép-konfigurációval létrehozott készletek esetén engedélyezze a 29876-os és a 29877-es portokat, valamint a 22-es portot Linux, illetve a 3389-es portot Windows rendszer esetén. A felhőszolgáltatás-konfigurációval létrehozott készletek esetén engedélyezze a 10100-as, 20100-as és 30100-as portokat. Emellett engedélyezze a kimenő kapcsolatokat az Azure Storage-hoz a 443-as porton. A cloudServiceConfiguration-készletek esetében csak a "klasszikus" VNET-ek támogatottak. További részletekért lásd: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration
|
NetworkSecurityGroupRule
Egy bejövő végpontra alkalmazandó hálózati biztonságicsoport-szabály.
Name |
Típus |
Description |
access
|
NetworkSecurityGroupRuleAccess
|
A megadott IP-címhez, alhálózati tartományhoz vagy címkéhez végrehajtandó művelet.
|
priority
|
integer
|
A szabály prioritása.
A készleten belüli prioritásoknak egyedinek kell lenniük, és prioritás szerinti sorrendben kell kiértékelniük. Minél alacsonyabb a szám, annál magasabb a prioritás. A szabályokat például 150, 250 és 350 sorszámmal lehet megadni. A 150-es sorszámú szabály elsőbbséget élvez a 250-es sorrendű szabállyal szemben. Az engedélyezett prioritások 150 és 4096 között vannak. Ha a rendszer fenntartott vagy duplikált értékeket ad meg, a kérés a 400-ás HTTP-állapotkóddal meghiúsul.
|
sourceAddressPrefix
|
string
|
A szabálynak megfelelő forráscímelőtag vagy címke.
Az érvényes értékek egyetlen IP-cím (például 10.10.10.10), IP-alhálózat (pl. 192.168.1.0/24), alapértelmezett címke vagy * (minden címhez). Ha más értékeket is megad, a kérés a 400-ás HTTP-állapotkóddal meghiúsul.
|
sourcePortRanges
|
string[]
|
A szabálynak megfelelő forrásporttartományok.
Az érvényes értékek a "*" (minden 0-65535-ös portra) vagy portok vagy porttartományok tömbjei (pl. 100-200). A portoknak 0 és 65535 közötti tartományban kell lennie, és a porttartományok vagy portok nem fedhetik át egymást. Ha más értékeket is megad, a kérés a 400-ás HTTP-állapotkóddal meghiúsul. Az alapértelmezett érték a *.
|
NetworkSecurityGroupRuleAccess
A megadott IP-címhez, alhálózati tartományhoz vagy címkéhez végrehajtandó művelet.
Name |
Típus |
Description |
Allow
|
string
|
Hozzáférés engedélyezése.
|
Deny
|
string
|
Hozzáférés megtagadása.
|
NFSMountConfiguration
NFS-fájlrendszerhez való csatlakozáshoz használt információk.
Name |
Típus |
Description |
mountOptions
|
string
|
További parancssori beállítások a csatlakoztatási parancsnak való továbbításhoz.
Ezek a windowsos "net use" és a linuxos "csatlakoztatási" lehetőségek.
|
relativeMountPath
|
string
|
A relatív elérési út azon a számítási csomóponton, amelyen a fájlrendszer csatlakoztatva lesz
Az összes fájlrendszer a Batch csatlakoztatási könyvtárához képest van csatlakoztatva, amely a AZ_BATCH_NODE_MOUNTS_DIR környezeti változón keresztül érhető el.
|
source
|
string
|
A csatlakoztatni kívánt fájlrendszer URI-ja.
|
NodeCommunicationMode
Meghatározza, hogy a készlet hogyan kommunikál a Batch szolgáltatással.
Name |
Típus |
Description |
Classic
|
string
|
A klasszikus kommunikációs módot használó csomópontok bejövő TCP-kommunikációt igényelnek a "BatchNodeManagement" 29876-os és 29877-es porton. {region}" szolgáltatáscímke és kimenő TCP-kommunikáció a 443-as porton a "Storage.region" és a "BatchNodeManagement" felé. {region}" szolgáltatáscímkék.
|
Default
|
string
|
A csomópont kommunikációs módját a Batch szolgáltatás automatikusan beállítja.
|
Simplified
|
string
|
Az egyszerűsített kommunikációs módot használó csomópontok kimenő TCP-kommunikációt igényelnek a 443-es porton a "BatchNodeManagement" felé. {region}" szolgáltatáscímke. Nincs szükség nyitott bejövő portra.
|
NodePlacementConfiguration
Csomópontelhelyezési konfiguráció kötegkészletekhez.
Name |
Típus |
Description |
policy
|
NodePlacementPolicyType
|
Csomópontelhelyezési szabályzat típusa a Batch-készletekben.
A Batch Szolgáltatás által a csomópontok kiépítéséhez használt foglalási szabályzat. Ha nincs megadva, a Batch a regionális szabályzatot fogja használni.
|
NodePlacementPolicyType
A készletben lévő csomópontok lefoglalására vonatkozó elhelyezési szabályzat.
Name |
Típus |
Description |
Regional
|
string
|
A készlet összes csomópontja ugyanabban a régióban lesz lefoglalva.
|
Zonal
|
string
|
A készlet csomópontjai különböző zónákban lesznek elosztva a legjobb erőfeszítéselosztással.
|
OSDisk
A virtuális gép operációsrendszer-lemezének beállításai.
Name |
Típus |
Description |
caching
|
CachingType
|
Megadja a gyorsítótárazási követelményeket. Lehetséges értékek: None, ReadOnly, ReadWrite. Az alapértelmezett értékek a következők: Standard szintű tárolás esetén nincs. ReadOnly a Premium Storage-hoz.
|
diskSizeGB
|
integer
|
A kezdeti lemezméret GB-ban az új operációsrendszer-lemez létrehozásakor.
|
ephemeralOSDiskSettings
|
DiffDiskSettings
|
Megadja a virtuális gép által használt operációsrendszer-lemez rövid élettartamú lemezbeállításait.
|
managedDisk
|
ManagedDisk
|
A felügyelt lemez paraméterei.
|
writeAcceleratorEnabled
|
boolean
|
Megadja, hogy a writeAccelerator engedélyezve vagy letiltva legyen-e a lemezen.
|
Pool
Készletre vonatkozó információkat tartalmaz.
Name |
Típus |
Alapértelmezett érték |
Description |
etag
|
string
|
|
Az erőforrás ETagje, amely az egyidejűségi utasításokhoz használatos.
|
id
|
string
|
|
Az erőforrás azonosítója.
|
identity
|
BatchPoolIdentity
|
|
A Batch-készlethez használt identitás típusa.
A Batch-készlethez használt identitás típusa.
|
name
|
string
|
|
Az erőforrás neve.
|
properties.allocationState
|
AllocationState
|
|
Azt jelzi, hogy a készlet átméretez-e.
|
properties.allocationStateTransitionTime
|
string
|
|
A készlet aktuális foglalási állapotának megadásának időpontja.
|
properties.applicationLicenses
|
string[]
|
|
A Batch szolgáltatás által elérhetővé tenni kívánt alkalmazáslicencek listája a készlet minden számítási csomópontján.
Az alkalmazáslicencek listájának az elérhető Batch-szolgáltatásalkalmazás-licencek egy részhalmazának kell lennie. Ha olyan licencet kérnek, amely nem támogatott, a készlet létrehozása sikertelen lesz.
|
properties.applicationPackages
|
ApplicationPackageReference[]
|
|
A készlet minden számítási csomópontjára telepíteni kívánt alkalmazáscsomagok listája.
Az alkalmazáscsomag-hivatkozások módosítása hatással van a készlethez csatlakozó összes új számítási csomópontra, de nem érinti azokat a számítási csomópontokat, amelyek már a készletben vannak, amíg újra nem indítják vagy újra nem alakítják őket. Egy adott készleten legfeljebb 10 alkalmazáscsomag-hivatkozás található.
|
properties.autoScaleRun
|
AutoScaleRun
|
|
Az automatikus skálázási képlet legutóbbi végrehajtásának eredményei és hibái.
Ez a tulajdonság csak akkor van beállítva, ha a készlet automatikusan skáláz, azaz automatikus skálázási beállításokat használ.
|
properties.certificates
|
CertificateReference[]
|
|
A készlet minden számítási csomópontjára telepíteni kívánt tanúsítványok listája.
Windows számítási csomópontok esetén a Batch szolgáltatás telepíti a tanúsítványokat a megadott tanúsítványtárolóba és helyre. Linux számítási csomópontok esetén a tanúsítványok a feladat munkakönyvtárában található könyvtárban vannak tárolva, és a rendszer egy környezeti változót AZ_BATCH_CERTIFICATES_DIR a feladatnak, amely lekérdezi ezt a helyet. A "remoteUser" láthatóságú tanúsítványok esetében a rendszer létrehoz egy "certs" könyvtárat a felhasználó kezdőkönyvtárában (pl. /home/{user-name}/certs), és a tanúsítványok ebben a könyvtárban vannak elhelyezve.
Figyelmeztetés: Ez a tulajdonság elavult, és 2024 februárja után törlődik. Használja inkább az Azure KeyVault bővítményt .
|
properties.creationTime
|
string
|
|
A készlet létrehozási ideje.
|
properties.currentDedicatedNodes
|
integer
|
|
A készletben jelenleg található dedikált számítási csomópontok száma.
|
properties.currentLowPriorityNodes
|
integer
|
|
A készletben jelenleg található kihasználatlan/alacsony prioritású számítási csomópontok száma.
|
properties.currentNodeCommunicationMode
|
NodeCommunicationMode
|
|
A készlet kommunikációs üzemmódjának aktuális állapota.
|
properties.deploymentConfiguration
|
DeploymentConfiguration
|
|
Ez a tulajdonság a készletcsomópontok üzembe helyezésének módját ismerteti Cloud Services vagy Virtual Machines használatával.
A CloudServiceConfiguration használatával megadhatja, hogy a csomópontokat az Azure Cloud Services (PaaS) használatával kell létrehozni, míg a VirtualMachineConfiguration az Azure Virtual Machines (IaaS) szolgáltatást használja.
|
properties.displayName
|
string
|
|
A készlet megjelenítendő neve.
A megjelenítendő névnek nem kell egyedinek lennie, és legfeljebb 1024 hosszúságú Unicode-karaktereket tartalmazhat.
|
properties.interNodeCommunication
|
InterNodeCommunicationState
|
|
Azt jelzi, hogy a készlet engedélyezi-e a csomópontok közötti közvetlen kommunikációt.
Ez korlátozza, hogy mely csomópontok rendelhetők hozzá a készlethez. Ennek az értéknek az engedélyezése csökkentheti a készletben lefoglalandó csomópontok kért számának esélyét. Ha nincs megadva, ez az érték alapértelmezés szerint "Letiltva".
|
properties.lastModified
|
string
|
|
A készlet utolsó módosítási időpontja.
Ez az utolsó alkalom, amikor a készletszintű adatok, például a targetDedicatedNodes vagy az autoScaleSettings módosultak. Nem befolyásolja a csomópontszintű változásokat, például a számítási csomópontok változási állapotát.
|
properties.metadata
|
MetadataItem[]
|
|
A készlethez metaadatként társított név-érték párok listája.
A Batch szolgáltatás nem rendel semmilyen jelentést a metaadatokhoz; kizárólag felhasználói kód használatára szolgál.
|
properties.mountConfiguration
|
MountConfiguration[]
|
|
A készlet minden csomópontjára csatlakoztatni kívánt fájlrendszerek listája.
Ez támogatja a Azure Files, az NFS, a CIFS/SMB és a Blobfuse használatát.
|
properties.networkConfiguration
|
NetworkConfiguration
|
|
A készlet hálózati konfigurációja.
A készlet hálózati konfigurációja.
|
properties.provisioningState
|
PoolProvisioningState
|
|
A készlet aktuális állapota.
|
properties.provisioningStateTransitionTime
|
string
|
|
A készlet aktuális állapotának megadásának időpontja.
|
properties.resizeOperationStatus
|
ResizeOperationStatus
|
|
Az aktuális vagy az utolsó befejezett átméretezési művelet részleteit tartalmazza.
Az aktuális műveletet (ha a készlet AllocationState átméretezése) vagy a korábban befejezett műveletet írja le (ha a AllocationState állandó).
|
properties.resourceTags
|
object
|
|
A készlethez társított felhasználó által megadott címkék.
A Azure Batch készlethez társítandó felhasználó által definiált címkék. Ha meg van adva, a rendszer propagálja ezeket a címkéket a készlethez társított háttérbeli Azure-erőforrásokba. Ez a tulajdonság csak akkor adható meg, ha a Batch-fiók létrejött, és a poolAllocationMode tulajdonság értéke "UserSubscription".
|
properties.scaleSettings
|
ScaleSettings
|
|
A készletben lévő csomópontok számát konfiguráló beállítások.
Meghatározza a készlet kívánt méretét. Ez lehet "rögzített skálázás", ha meg van adva a kért targetDedicatedNodes, vagy az "automatikus skálázás", amely egy rendszeresen újraértékelt képletet definiál. Ha ez a tulajdonság nincs megadva, a készlet rögzített skálával fog rendelkezni 0 targetDedicatedNodes értékekkel.
|
properties.startTask
|
StartTask
|
|
Az egyes számítási csomópontokon a készlethez való csatlakozáskor futtatandó feladat.
A PATCH (frissítési) műveletben ez a tulajdonság egy üres objektumra állítható be, hogy eltávolítsa a kezdő tevékenységet a készletből.
|
properties.targetNodeCommunicationMode
|
NodeCommunicationMode
|
|
A készlet kívánt csomópontkommunikációs módja.
Ha nincs megadva, az alapértelmezett érték az Alapértelmezett.
|
properties.taskSchedulingPolicy
|
TaskSchedulingPolicy
|
|
A tevékenységek elosztása a készlet számítási csomópontjai között.
Ha nincs megadva, az alapértelmezett oldalpár.
|
properties.taskSlotsPerNode
|
integer
|
1
|
A készlet egyetlen számítási csomópontján egyidejű feladatok futtatására használható feladathelyek száma.
Az alapértelmezett érték az 1. A maximális érték a készlet vmSize magjainak számának négyszerese vagy 256.
|
properties.upgradePolicy
|
UpgradePolicy
|
|
A készlet frissítési szabályzata.
Egy frissítési szabályzatot ír le – automatikus, manuális vagy működés közben.
|
properties.userAccounts
|
UserAccount[]
|
|
A készlet minden csomópontján létrehozandó felhasználói fiókok listája.
|
properties.vmSize
|
string
|
|
A készletben lévő virtuális gépek mérete. A készlet összes virtuális gépe azonos méretű.
A Cloud Services készletekhez (a cloudServiceConfiguration használatával létrehozott készletekhez) elérhető virtuális gépek méretével kapcsolatos információkért lásd: Cloud Services méretei (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). A Batch az ExtraSmall kivételével minden Cloud Services virtuálisgép-méretet támogatja. A Virtual Machines Marketplace-en (virtualMachineConfiguration használatával létrehozott készletek) rendszerképeket használó készletek rendelkezésre álló virtuálisgép-méreteivel kapcsolatos információkért lásd: Virtual Machines méretei (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) vagy Virtual Machines méretei (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). A Batch az összes Azure-beli virtuálisgép-méretet támogatja, kivéve a STANDARD_A0 és a prémium szintű tárolóval (STANDARD_GS, STANDARD_DS és STANDARD_DSV2 sorozattal rendelkezőket).
|
type
|
string
|
|
Az erőforrás típusa.
|
PoolEndpointConfiguration
Egy készlet végpontkonfigurációja.
Name |
Típus |
Description |
inboundNatPools
|
InboundNatPool[]
|
Az egyes számítási csomópontok adott portjainak külső kezelésére használható bejövő NAT-készletek listája.
A bejövő NAT-készletek batch-készletenként maximális száma 5. Ha túllépi a bejövő NAT-készletek maximális számát, a kérés a 400-as HTTP-állapotkóddal meghiúsul. Ez nem adható meg, ha az IPAddressProvisioningType noPublicIPAddresses.
|
PoolIdentityType
A Batch-készlethez használt identitás típusa.
Name |
Típus |
Description |
None
|
string
|
A Batch-készlethez nincs identitás társítva. A None frissítési készlet beállítása eltávolítja a meglévő identitásokat.
|
UserAssigned
|
string
|
A Batch-készlethez felhasználó által hozzárendelt identitások tartoznak.
|
PoolProvisioningState
A készlet aktuális állapota.
Name |
Típus |
Description |
Deleting
|
string
|
A felhasználó kérte a készlet törlését, de a törlési művelet még nem fejeződött be.
|
Succeeded
|
string
|
A készlet a számítási csomópontok rendelkezésre állásától függő feladatok futtatásához érhető el.
|
PublicIPAddressConfiguration
A készlet hálózati konfigurációjának nyilvános IP-címkonfigurációja.
Name |
Típus |
Description |
ipAddressIds
|
string[]
|
Azon nyilvános IP-címek listája, amelyeket a Batch szolgáltatás használni fog a számítási csomópontok kiépítésekor.
Az itt megadott IP-címek száma korlátozza a készlet maximális méretét – 100 dedikált csomópont vagy 100 kihasználatlan/alacsony prioritású csomópont foglalható le minden nyilvános IP-címhez. Egy 250 dedikált virtuális gépet igénylő készletnek például legalább 3 nyilvános IP-címet kell megadnia. A gyűjtemény minden eleme a következő formátumú: /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}.
|
provision
|
IPAddressProvisioningType
|
A készlet nyilvános IP-címeinek kiépítési típusa
Az alapértelmezett érték a BatchManaged
|
ResizeError
Hiba történt egy készlet átméretezésekor.
Name |
Típus |
Description |
code
|
string
|
A hiba azonosítója. A kódok invariánsak, és programozott módon használhatók.
|
details
|
ResizeError[]
|
A hibával kapcsolatos további részletek.
|
message
|
string
|
A hibát leíró üzenet, amely alkalmas a felhasználói felületen való megjelenítésre.
|
ResizeOperationStatus
Az aktuális vagy az utolsó befejezett átméretezési művelet részletei.
Name |
Típus |
Description |
errors
|
ResizeError[]
|
A készlet utolsó átméretezése során előforduló hibák részletei.
Ez a tulajdonság csak akkor van beállítva, ha hiba történt az utolsó készlet átméretezésekor, és csak akkor, ha a készlet foglalása Állandó.
|
nodeDeallocationOption
|
ComputeNodeDeallocationOption
|
Meghatározza, hogy mi a teendő egy csomóponttal és annak futó tevékenységeivel, ha a készlet mérete csökken.
Az alapértelmezett érték az újra lekérdezés.
|
resizeTimeout
|
string
|
A számítási csomópontok készlethez való lefoglalásának vagy a számítási csomópontok készletből való eltávolításának időtúllépése.
Az alapértelmezett érték 15 perc. A minimális érték 5 perc. Ha 5 percnél rövidebb értéket ad meg, a Batch szolgáltatás hibát ad vissza; Ha közvetlenül a REST API-t hívja meg, a HTTP-állapotkód 400 (hibás kérés).
|
startTime
|
string
|
Az átméretezési művelet elindításának időpontja.
|
targetDedicatedNodes
|
integer
|
A készletben található dedikált számítási csomópontok kívánt száma.
|
targetLowPriorityNodes
|
integer
|
A készletben lévő kihasználatlan/alacsony prioritású számítási csomópontok kívánt száma.
|
ResourceFile
Egy vagy több fájl, amely egy számítási csomópontra tölthető le.
Name |
Típus |
Description |
autoStorageContainerName
|
string
|
A tároló neve az automatikus tárfiókban.
Az autoStorageContainerName, storageContainerUrl és httpUrl tulajdonságok kölcsönösen kizárják egymást, és meg kell adni közülük egyet.
|
blobPrefix
|
string
|
A blobok Azure Storage-tárolóból való letöltésekor használandó blobelőtag. Csak azok a blobok töltődnek le, amelyeknek a neve a megadott előtaggal kezdődik.
A tulajdonság csak az autoStorageContainerName vagy storageContainerUrl használatakor érvényes. Ez az előtag lehet részleges fájlnév vagy alkönyvtár. Ha nincs megadva előtag, a tárolóban lévő összes fájl le lesz töltve.
|
fileMode
|
string
|
A fájlengedélyezési mód attribútuma oktális formátumban.
Ez a tulajdonság csak a Linux számítási csomópontokra letöltött fájlokra vonatkozik. A rendszer figyelmen kívül hagyja, ha meg van adva egy resourceFile fájlhoz, amely egy Windows-csomópontra lesz letöltve. Ha ez a tulajdonság nincs megadva Linux-csomóponthoz, akkor a rendszer a 0770 alapértelmezett értéket alkalmazza a fájlra.
|
filePath
|
string
|
A számítási csomópont azon helye, amelyre a fájlt le szeretné tölteni a tevékenység munkakönyvtárához viszonyítva.
Ha a httpUrl tulajdonság meg van adva, a filePath megadása kötelező, és leírja a fájl letöltési útvonalát, beleértve a fájlnevet is. Ellenkező esetben, ha az autoStorageContainerName vagy storageContainerUrl tulajdonság meg van adva, a filePath nem kötelező, és az a könyvtár, amelyre a fájlokat le szeretné tölteni. Abban az esetben, ha a filePath könyvtárként van használatban, a bemeneti adatokhoz már társított könyvtárstruktúrát a rendszer teljes egészében megőrzi, és hozzáfűzi a megadott filePath könyvtárhoz. A megadott relatív elérési út nem bontható ki a tevékenység munkakönyvtárából (például a ".." használatával).
|
httpUrl
|
string
|
A letölteni kívánt fájl URL-címe.
Az autoStorageContainerName, storageContainerUrl és httpUrl tulajdonságok kölcsönösen kizárják egymást, és meg kell adni közülük egyet. Ha az URL-cím Azure Blob Storage mutat, akkor olvashatónak kell lennie a számítási csomópontokról. Egy blob ilyen URL-címének lekérése háromféleképpen lehetséges az Azure Storage-ban: tartalmazzon egy közös hozzáférésű jogosultságkódot (SAS), amely olvasási engedélyeket ad a blobhoz, használjon olvasási engedéllyel rendelkező felügyelt identitást, vagy állítsa be a blob vagy a tároló ACL-jét a nyilvános hozzáférés engedélyezéséhez.
|
identityReference
|
ComputeNodeIdentityReference
|
A storageContainerUrl vagy a httpUrl által meghatározott Azure Blob Storage eléréséhez használandó felhasználó által hozzárendelt identitásra mutató hivatkozás
A számítási csomópont által használt Batch-készlethez társított felhasználó által hozzárendelt identitásra mutató hivatkozás.
|
storageContainerUrl
|
string
|
A blobtároló URL-címe Azure Blob Storage.
Az autoStorageContainerName, storageContainerUrl és httpUrl tulajdonságok kölcsönösen kizárják egymást, és meg kell adni közülük egyet. Ennek az URL-címnek olvashatónak és listázhatónak kell lennie a számítási csomópontokról. Az Azure Storage-tárolókhoz háromféleképpen lehet ilyen URL-címet beszerezni: tartalmazzon egy közös hozzáférésű jogosultságkódot (SAS), amely olvasási és listázási engedélyeket ad a tárolóhoz, használjon olvasási és listázási engedélyekkel rendelkező felügyelt identitást, vagy állítsa be a tároló ACL-ét a nyilvános hozzáférés engedélyezéséhez.
|
RollingUpgradePolicy
A működés közbeni frissítés során használt konfigurációs paraméterek.
Name |
Típus |
Description |
enableCrossZoneUpgrade
|
boolean
|
Lehetővé teszi, hogy a VMSS figyelmen kívül hagyja az AZ-határokat a frissítési kötegek létrehozásakor. A köteg méretének meghatározásához vegye figyelembe az Update Domain és a maxBatchInstancePercent tartományt. Ha ez a mező nincs beállítva, az Azure Azure Batch nem állítja be az alapértelmezett értékét. A létrehozott VirtualMachineScaleSet enableCrossZoneUpgrade értékét a VirtualMachineScaleSet alapértelmezett konfigurációi határozzák meg. Ez a mező csak akkor állítható be igaz vagy hamis értékre, ha a NodePlacementConfigurationt Zonalként használja.
|
maxBatchInstancePercent
|
integer
|
Az összes virtuálisgép-példány maximális százaléka, amelyet a folyamatos frissítés egy kötegben egyszerre frissít. Mivel ez egy korábbi vagy jövőbeli kötegek maximális, nem kifogástalan állapotú példányai, a nagyobb megbízhatóság érdekében a köteg példányainak százalékos aránya csökkenhet. Ennek a mezőnek az értéke 5 és 100 között lehet, beleértve a értéket is. Ha a maxBatchInstancePercent és a maxUnhealthyInstancePercent is értékhez van rendelve, a maxBatchInstancePercent értéke nem lehet több, mint maxUnhealthyInstancePercent.
|
maxUnhealthyInstancePercent
|
integer
|
A méretezési csoportban lévő összes virtuálisgép-példány maximális százalékos aránya, amely egyidejűleg nem kifogástalan állapotú lehet a frissítés eredményeként, vagy ha a virtuális gép állapota nem megfelelő állapotban található a működés közbeni frissítés megszakítása előtt. Ezt a kényszert a köteg indítása előtt ellenőrzi a rendszer. Ennek a mezőnek az értéke 5 és 100 között lehet, beleértve a értéket is. Ha a maxBatchInstancePercent és a maxUnhealthyInstancePercent is értékhez van rendelve, a maxBatchInstancePercent értéke nem lehet több, mint maxUnhealthyInstancePercent.
|
maxUnhealthyUpgradedInstancePercent
|
integer
|
A frissített virtuálisgép-példányok maximális százalékos aránya, amely nem kifogástalan állapotban található. Ez az ellenőrzés az egyes kötegek frissítése után történik. Ha ezt a százalékos értéket valaha is túllépi, a működés közbeni frissítés leáll. A mező értékének 0 és 100 közé kell esnie, beleértve a értéket is.
|
pauseTimeBetweenBatches
|
string
|
Az egy kötegben lévő összes virtuális gép frissítésének befejezése és a következő köteg indítása közötti várakozási idő. Az időtartamot ISO 8601 formátumban kell megadni.
|
prioritizeUnhealthyInstances
|
boolean
|
Frissítse a méretezési csoport összes nem kifogástalan állapotú példányát az kifogástalan állapotú példányok előtt.
|
rollbackFailedInstancesOnPolicyBreach
|
boolean
|
A korábbi modellre való visszaállítás sikertelen volt, ha a működés közbeni frissítési szabályzatot megsértették.
|
ScaleSettings
A készlet méretezési beállításai
Name |
Típus |
Description |
autoScale
|
AutoScaleSettings
|
A készlet automatikus skálázási beállításai.
Ez a tulajdonság és a rögzített skálázás kölcsönösen kizáróak, és meg kell adni az egyik tulajdonságot.
|
fixedScale
|
FixedScaleSettings
|
Kijavítottuk a készlet méretezési beállításait.
Ez a tulajdonság és az automatikus skálázás kölcsönösen kizárja egymást, és meg kell adni az egyik tulajdonságot.
|
SecurityProfile
Megadja a virtuális gép vagy a virtuálisgép-méretezési csoport biztonsági profilbeállításait.
Name |
Típus |
Description |
encryptionAtHost
|
boolean
|
Ezt a tulajdonságot a felhasználó használhatja a kérelemben a virtuális gép vagy virtuálisgép-méretezési csoport gazdagéptitkosításának engedélyezésére vagy letiltására. Ez lehetővé teszi a titkosítást az összes lemezen, beleértve magát a gazdagép erőforrás-/ideiglenes lemezét is.
|
securityType
|
SecurityTypes
|
A virtuális gép SecurityType tulajdonságát adja meg. Az UefiSettings engedélyezéséhez minden megadott értékre be kell állítani.
|
uefiSettings
|
UefiSettings
|
Megadja a virtuális gép létrehozásakor használt biztonsági beállításokat, például a biztonságos rendszerindítást és a vTPM-et.
Megadja a virtuális gép létrehozásakor használt biztonsági beállításokat, például a biztonságos rendszerindítást és a vTPM-et.
|
SecurityTypes
A virtuális gép SecurityType tulajdonságát adja meg. Az UefiSettings engedélyezéséhez minden megadott értékre be kell állítani.
Name |
Típus |
Description |
trustedLaunch
|
string
|
A megbízható indítás védelmet nyújt a fejlett és állandó támadási technikák ellen.
|
ServiceArtifactReference
Megadja azt a szolgáltatásösszetevő-referencia-azonosítót, amellyel a méretezési csoport összes virtuális gépéhez ugyanazt a rendszerképverziót állíthatja be a "legújabb" rendszerképverzió használatakor.
Name |
Típus |
Description |
id
|
string
|
A ServiceArtifactReference szolgáltatásösszetevő-referenciaazonosítója
A szolgáltatásösszetevő referencia-azonosítója /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/gallerys/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName} formában
|
StartTask
Olyan feladat, amely akkor fut, amikor egy számítási csomópont csatlakozik egy készlethez a Azure Batch szolgáltatásban, vagy amikor a számítási csomópont újraindul vagy újra létre lesz hozva.
Name |
Típus |
Alapértelmezett érték |
Description |
commandLine
|
string
|
|
Az indítási feladat parancssora.
A parancssor nem rendszerhéj alatt fut, ezért nem tudja kihasználni a rendszerhéj olyan funkcióit, mint a környezeti változók bővítése. Ha ki szeretné használni az ilyen funkciókat, hívja meg a rendszerhéjat a parancssorban, például a windowsos "cmd /c MyCommand" vagy a "/bin/sh -c MyCommand" parancsmagot Linuxon. Kötelező, ha a startTask bármely más tulajdonsága meg van adva.
|
containerSettings
|
TaskContainerSettings
|
|
Annak a tárolónak a beállításai, amelyek alatt az indítási feladat fut.
Ha ez meg van adva, a AZ_BATCH_NODE_ROOT_DIR alatti összes könyvtár rekurzív módon (a csomóponton Azure Batch címtárak gyökere) a tárolóba lesz leképezve, az összes tevékenységkörnyezeti változó a tárolóba lesz leképezve, a feladat parancssora pedig a tárolóban lesz végrehajtva.
|
environmentSettings
|
EnvironmentSetting[]
|
|
Az indítási tevékenység környezeti változóbeállításainak listája.
|
maxTaskRetryCount
|
integer
|
0
|
A tevékenység újrapróbálkozásának maximális száma.
A Batch szolgáltatás újrapróbál egy feladatot, ha a kilépési kódja nem nulla. Vegye figyelembe, hogy ez az érték kifejezetten az újrapróbálkozások számát szabályozza. A Batch szolgáltatás egyszer próbálja ki a feladatot, majd megpróbálkozhat ezzel a korláttal. Ha például a maximális újrapróbálkozások száma 3, a Batch legfeljebb 4 alkalommal próbálja meg a feladatot (egy kezdeti próbálkozás és 3 újrapróbálkozás). Ha az újrapróbálkozás maximális száma 0, a Batch szolgáltatás nem próbálkozik újra a feladattal. Ha az újrapróbálkozások maximális száma -1, a Batch szolgáltatás korlátozás nélkül újrapróbálkozásokat fog végrehajtani. Az alapértelmezett érték: 0
|
resourceFiles
|
ResourceFile[]
|
|
Azon fájlok listája, amelyeket a Batch szolgáltatás letölt a számítási csomópontra a parancssor futtatása előtt.
|
userIdentity
|
UserIdentity
|
|
Az a felhasználói identitás, amely alatt az indítási feladat fut.
Ha nincs megadva, a feladat nem rendszergazdai felhasználóként fut, amely egyedi a feladathoz.
|
waitForSuccess
|
boolean
|
|
Azt jelzi, hogy a Batch szolgáltatásnak várnia kell-e az indítási tevékenység sikeres befejezésére (azaz a 0-s kilépési kóddal való kilépésre) a számítási csomóponton lévő tevékenységek ütemezése előtt.
Ha igaz, és az indítási feladat meghiúsul egy számítási csomóponton, a Batch szolgáltatás a maximális újrapróbálkozások számával (maxTaskRetryCount) próbálkozik újra. Ha a tevékenység az összes újrapróbálkozás után sem fejeződött be sikeresen, akkor a Batch szolgáltatás használhatatlanként jelöli meg a számítási csomópontot, és nem ütemezi a tevékenységeket. Ez a feltétel a csomópont állapotán és az ütemezési hiba részletein keresztül észlelhető. Ha hamis, a Batch szolgáltatás nem várja meg az indítási feladat befejezését. Ebben az esetben más tevékenységek is megkezdhetik a végrehajtást a számítási csomóponton, amíg az indítási tevékenység még fut; és akkor is, ha az indítási tevékenység meghiúsul, az új tevékenységek továbbra is ütemezve lesznek a csomóponton. Az alapértelmezett érték igaz.
|
StorageAccountType
A tárfiók típusa adatlemezek vagy operációsrendszer-lemezek létrehozásához.
Name |
Típus |
Description |
Premium_LRS
|
string
|
Az adatlemeznek/operációsrendszer-lemeznek prémium helyileg redundáns tárolást kell használnia.
|
StandardSSD_LRS
|
string
|
Az adatlemeznek/operációsrendszer-lemeznek szabványos, helyileg redundáns SSD-tárolót kell használnia.
|
Standard_LRS
|
string
|
Az adatlemeznek/operációsrendszer-lemeznek szabványos helyileg redundáns tárolást kell használnia.
|
TaskContainerSettings
A feladat tárolóbeállításai.
Name |
Típus |
Description |
containerRunOptions
|
string
|
További lehetőségek a tároló létrehozása parancshoz.
Ezek a további lehetőségek a "docker create" parancs argumentumaiként vannak megadva a Batch szolgáltatás által szabályozottak mellett.
|
imageName
|
string
|
A tároló létrehozásához használni kívánt rendszerkép, amelyben a feladat futni fog.
Ez a teljes rendszerkép-hivatkozás, ahogyan a "docker pull" esetében meg van adva. Ha a kép neve nem tartalmaz címkét, a rendszer alapértelmezés szerint a "latest" címkét használja.
|
registry
|
ContainerRegistry
|
A tárolólemezképet tartalmazó privát beállításjegyzék.
Ez a beállítás kihagyható, ha már meg lett adva a készlet létrehozásakor.
|
workingDirectory
|
ContainerWorkingDirectory
|
Jelölő, amely jelzi, hogy hol található a tárolófeladat munkakönyvtára. Az alapértelmezett érték a "taskWorkingDirectory".
|
TaskSchedulingPolicy
Meghatározza, hogy a tevékenységek hogyan legyenek elosztva a számítási csomópontok között.
Name |
Típus |
Alapértelmezett érték |
Description |
nodeFillType
|
ComputeNodeFillType
|
Spread
|
Hogyan kell elosztani a feladatokat a számítási csomópontok között.
|
UefiSettings
Megadja a virtuális gép létrehozásakor használt biztonsági beállításokat, például a biztonságos rendszerindítást és a vTPM-et.
Name |
Típus |
Description |
secureBootEnabled
|
boolean
|
Meghatározza, hogy engedélyezni kell-e a biztonságos rendszerindítást a virtuális gépen.
|
vTpmEnabled
|
boolean
|
Meghatározza, hogy a vTPM engedélyezve legyen-e a virtuális gépen.
|
UpgradeMode
Megadja a méretezési csoportban lévő virtuális gépekre való frissítés módját.
Lehetséges értékek:
Manuális – A méretezési csoportban lévő virtuális gépek frissítéseinek alkalmazását szabályozhatja. Ezt a manualUpgrade művelet használatával teheti meg.
Automatikus – A méretezési csoport összes virtuális gépe automatikusan frissül.
Működés közben – A méretezési csoport kötegekben hajtja végre a frissítéseket, és a szünetidő nem kötelező.
Name |
Típus |
Description |
automatic
|
string
|
A méretezési csoport összes virtuális gépe automatikusan frissül egyszerre.
|
manual
|
string
|
Szabályozhatja a méretezési csoportban lévő virtuális gépek frissítéseinek alkalmazását. Ezt a manualUpgrade művelet használatával teheti meg.
|
rolling
|
string
|
A méretezési csoport meglévő példányai kötegekben lesznek leállítva, hogy frissíthetők legyenek. A frissített köteg befejezése után a példányok ismét megkezdik a forgalom felvételét, és a következő köteg megkezdődik. Ez mindaddig folytatódik, amíg az összes példány naprakész nem lesz.
|
UpgradePolicy
Egy frissítési szabályzatot ír le – automatikus, manuális vagy működés közben.
Name |
Típus |
Description |
automaticOSUpgradePolicy
|
AutomaticOSUpgradePolicy
|
Az automatikus operációsrendszer-frissítés végrehajtásához használt konfigurációs paraméterek.
Az automatikus operációsrendszer-frissítés végrehajtásához használt konfigurációs paraméterek.
|
mode
|
UpgradeMode
|
Megadja a méretezési csoportban lévő virtuális gépekre való frissítés módját.
Lehetséges értékek:
Manuális – A méretezési csoportban lévő virtuális gépek frissítéseinek alkalmazását szabályozhatja. Ezt a manualUpgrade művelet használatával teheti meg.
Automatikus – A méretezési csoport összes virtuális gépe automatikusan frissül.
Működés közben – A méretezési csoport kötegekben hajtja végre a frissítéseket, és a szünetidő nem kötelező.
|
rollingUpgradePolicy
|
RollingUpgradePolicy
|
A működés közbeni frissítés során használt konfigurációs paraméterek.
Ez a tulajdonság csak a virtualMachineConfiguration tulajdonsággal rendelkező készletekben támogatott.
|
UserAccount
Egy felhasználó Azure Batch csomóponton való létrehozásához használt tulajdonságok.
Name |
Típus |
Description |
elevationLevel
|
ElevationLevel
|
A felhasználói fiók jogosultságszintjének emelése.
nonAdmin – Az automatikus felhasználó emelt szintű hozzáférés nélküli standard felhasználó. admin – Az automatikus felhasználó emelt szintű hozzáféréssel rendelkező felhasználó, és teljes rendszergazdai engedélyekkel működik. Az alapértelmezett érték a nonAdmin.
|
linuxUserConfiguration
|
LinuxUserConfiguration
|
A felhasználói fiók Linux-specifikus felhasználói konfigurációja.
Ezt a tulajdonságot a rendszer figyelmen kívül hagyja, ha egy Windows-készletben van megadva. Ha nincs megadva, a felhasználó az alapértelmezett beállításokkal jön létre.
|
name
|
string
|
A felhasználói fiók neve. A nevek legfeljebb 20 Unicode-karaktert tartalmazhatnak.
|
password
|
string
|
A felhasználói fiók jelszava.
|
windowsUserConfiguration
|
WindowsUserConfiguration
|
A felhasználói fiók Windows-specifikus felhasználói konfigurációja.
Ez a tulajdonság csak akkor adható meg, ha a felhasználó Windows-készletben van. Ha nincs megadva, és Windows-készleten van megadva, a felhasználó az alapértelmezett beállításokkal jön létre.
|
UserAssignedIdentities
A társított felhasználói identitások listája.
Name |
Típus |
Description |
clientId
|
string
|
A felhasználó által hozzárendelt identitás ügyfélazonosítója.
|
principalId
|
string
|
A felhasználó által hozzárendelt identitás egyszerű azonosítója.
|
UserIdentity
Annak a felhasználói identitásnak a definíciója, amely alatt a feladat fut.
Name |
Típus |
Description |
autoUser
|
AutoUserSpecification
|
Az automatikus felhasználó, amely alatt a feladat fut.
A userName és az autoUser tulajdonságok kölcsönösen kizárják egymást; meg kell adnia egyet, de nem mindkettőt.
|
userName
|
string
|
Annak a felhasználói identitásnak a neve, amely alatt a feladat fut.
A userName és az autoUser tulajdonságok kölcsönösen kizárják egymást; meg kell adnia egyet, de nem mindkettőt.
|
VirtualMachineConfiguration
A számítási csomópontok konfigurációja egy készletben az Azure Virtual Machines infrastruktúráján alapul.
Name |
Típus |
Description |
containerConfiguration
|
ContainerConfiguration
|
A készlet tárolókonfigurációja.
Ha meg van adva, a rendszer a készlet minden csomópontján elvégzi a telepítést, hogy a tevékenységek tárolókban fussanak. Az ezen a készleten futó összes normál tevékenységnek és feladatkezelő tevékenységnek meg kell adnia a containerSettings tulajdonságot, és minden más tevékenység megadhatja.
|
dataDisks
|
DataDisk[]
|
A készlet számítási csomópontjaihoz csatolt adatlemezek konfigurációja.
Ezt a tulajdonságot akkor kell megadni, ha a készlet számítási csomópontjaihoz üres adatlemezeket kell csatolni.
|
diskEncryptionConfiguration
|
DiskEncryptionConfiguration
|
A készlet lemeztitkosítási konfigurációja.
Ha meg van adva, a rendszer titkosítást hajt végre a készlet minden csomópontján a csomópontok kiépítése során.
|
extensions
|
VMExtension[]
|
A készlet virtuálisgép-bővítménye.
Ha meg van adva, az ebben a konfigurációban említett bővítmények minden csomópontra települnek.
|
imageReference
|
ImageReference
|
Hivatkozás az Azure Virtual Machines Marketplace-rendszerképre vagy a használni kívánt egyéni virtuálisgép-rendszerképre.
|
licenseType
|
string
|
Az operációs rendszer üzembe helyezésekor használandó helyszíni licenc típusa.
Ez csak a Windows operációs rendszert tartalmazó rendszerképekre vonatkozik, és csak akkor használható, ha érvényes helyszíni licencekkel rendelkezik az üzembe helyezendő csomópontokhoz. Ha nincs megadva, a rendszer nem alkalmaz helyszíni licencelési kedvezményt. Az értékek a következők:
Windows_Server – A helyszíni licenc a Windows Serverhez tartozik.
Windows_Client – A helyszíni licenc a Windows-ügyfélhez tartozik.
|
nodeAgentSkuId
|
string
|
A készlet számítási csomópontjaira kiosztandó Batch-csomópontügynök termékváltozata.
A Batch csomópontügynök egy olyan program, amely a készlet minden csomópontján fut, és biztosítja a parancs- és vezérlési felületet a csomópont és a Batch szolgáltatás között. A csomópontügynöknek különböző implementációi vannak, más néven termékváltozatok a különböző operációs rendszerekhez. Meg kell adnia egy csomópontügynök termékváltozatát, amely megfelel a kiválasztott képhivatkozásnak. A támogatott csomópontügynök termékváltozatainak és az ellenőrzött képhivatkozások listájának lekéréséhez tekintse meg a "Támogatott csomópontügynök termékváltozatainak listázása" műveletet.
|
nodePlacementConfiguration
|
NodePlacementConfiguration
|
A készlet csomópontelhelyezési konfigurációja.
Ez a konfiguráció határozza meg a készlet csomópontjai fizikai lefoglalásának módját.
|
osDisk
|
OSDisk
|
A virtuális gép operációsrendszer-lemezének beállításai.
A rövid élettartamú OSDisk-beállítások konfigurációját tartalmazza.
|
securityProfile
|
SecurityProfile
|
Megadja a virtuális gép vagy a virtuálisgép-méretezési csoport biztonsági profilbeállításait.
Megadja a virtuális gép vagy a virtuálisgép-méretezési csoport biztonsági profilbeállításait.
|
serviceArtifactReference
|
ServiceArtifactReference
|
Megadja azt a szolgáltatásösszetevő-referencia-azonosítót, amellyel a méretezési csoport összes virtuális gépéhez ugyanazt a rendszerképverziót állíthatja be a "legújabb" rendszerképverzió használatakor.
A szolgáltatásösszetevő referenciaazonosítója /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/gallerys/{galleryName}/serviceArtifacts/{serviceArtifactName}/vmArtifactsProfiles/{vmArtifactsProfilesName} formában
|
windowsConfiguration
|
WindowsConfiguration
|
Windows operációs rendszer beállításai a virtuális gépen.
Ezt a tulajdonságot nem szabad megadni, ha az imageReference linuxos operációsrendszer-lemezképet ad meg.
|
VMExtension
A virtuálisgép-bővítmények konfigurációja.
Name |
Típus |
Description |
autoUpgradeMinorVersion
|
boolean
|
Azt jelzi, hogy a bővítménynek újabb alverziót kell-e használnia, ha az üzembe helyezéskor elérhető. Az üzembe helyezést követően azonban a bővítmény csak akkor frissíti az alverziókat, ha újra üzembe helyezi, még akkor sem, ha ez a tulajdonság true (igaz) értékre van állítva.
|
enableAutomaticUpgrade
|
boolean
|
Azt jelzi, hogy a bővítményt automatikusan frissítenie kell-e a platformnak, ha elérhető a bővítmény újabb verziója.
|
name
|
string
|
A virtuálisgép-bővítmény neve.
|
protectedSettings
|
object
|
A bővítmény tartalmazhat protectedSettings vagy protectedSettingsFromKeyVault beállítást, vagy egyáltalán nem tartalmaz védett beállításokat.
|
provisionAfterExtensions
|
string[]
|
A bővítménynevek gyűjteménye.
Bővítménynevek gyűjteménye, amely után ezt a bővítményt ki kell építeni.
|
publisher
|
string
|
A bővítménykezelő közzétevőjének neve.
|
settings
|
object
|
JSON formátumú nyilvános beállítások a bővítményhez.
|
type
|
string
|
A bővítmények típusa.
|
typeHandlerVersion
|
string
|
A szkriptkezelő verziója.
|
WindowsConfiguration
A virtuális gépre alkalmazandó Windows operációsrendszer-beállítások.
Name |
Típus |
Description |
enableAutomaticUpdates
|
boolean
|
Azt jelzi, hogy engedélyezve vannak-e az automatikus frissítések a virtuális gépen.
Ha nincs megadva, az alapértelmezett érték igaz.
|
WindowsUserConfiguration
A felhasználói fiók Windows-csomóponton való létrehozásához használt tulajdonságok.
Name |
Típus |
Description |
loginMode
|
LoginMode
|
Bejelentkezési mód a felhasználó számára
Megadja a felhasználó bejelentkezési módját. A VirtualMachineConfiguration-készletek alapértelmezett értéke az interaktív mód, a CloudServiceConfiguration-készletek esetében pedig a kötegelt mód.
|