使用指定的參數建立新的 Batch 帳戶。 現有的帳戶無法透過此 API 更新,而是應改用更新 Batch 帳戶 API 來更新。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts/{accountName}?api-version=2024-02-01
URI 參數
名稱 |
位於 |
必要 |
類型 |
Description |
accountName
|
path |
True
|
string
|
Batch 帳戶的名稱,該帳戶在區域內必須是唯一的。 批次帳戶名稱長度必須介於 3 到 24 個字元之間,而且只能使用數位和小寫字母。 此名稱會用來做為 DNS 名稱的一部分,用來存取帳戶建立所在區域中的 Batch 服務。 例如:http://accountname.region.batch.azure.com/。
Regex pattern: ^[a-z0-9]+$
|
resourceGroupName
|
path |
True
|
string
|
包含 Batch 帳戶的資源群組名稱。
|
subscriptionId
|
path |
True
|
string
|
Azure 訂用帳戶識別碼。 這是 GUID 格式的字串 (例如 0000000000-0000-0000-0000-0000000000000)
|
api-version
|
query |
True
|
string
|
要與 HTTP 要求搭配使用的 API 版本。
|
要求本文
名稱 |
必要 |
類型 |
Description |
location
|
True
|
string
|
要在其中建立帳戶的區域。
|
identity
|
|
BatchAccountIdentity
|
Batch 帳戶的身分識別。
|
properties.allowedAuthenticationModes
|
|
AuthenticationMode[]
|
Batch 帳戶允許的驗證模式清單,可用來向數據平面進行驗證。 這不會影響控制平面的驗證。
|
properties.autoStorage
|
|
AutoStorageBaseProperties
|
與自動記憶體帳戶相關的屬性。
|
properties.encryption
|
|
EncryptionProperties
|
Batch 帳戶的加密組態。
設定客戶數據如何在 Batch 帳戶內加密。 根據預設,帳戶會使用 Microsoft 受控金鑰進行加密。 如需其他控制,可以改用客戶管理的密鑰。
|
properties.keyVaultReference
|
|
KeyVaultReference
|
與 Batch 帳戶相關聯的 Azure 金鑰保存庫參考。
|
properties.networkProfile
|
|
NetworkProfile
|
Batch 帳戶的網路配置檔,其中包含每個端點的網路規則設定。
只有在啟用 publicNetworkAccess 時,網路配置檔才會生效。
|
properties.poolAllocationMode
|
|
PoolAllocationMode
|
在 Batch 帳戶中建立集區所使用的配置模式。
集區配置模式也會影響用戶端如何向 Batch 服務 API 進行驗證。 如果模式為 BatchService,用戶端可以使用存取金鑰或 Microsoft Entra ID 進行驗證。 如果模式為 UserSubscription,客戶端必須使用 Microsoft Entra ID。 預設值為 BatchService。
|
properties.publicNetworkAccess
|
|
PublicNetworkAccessType
|
用於存取 Azure Batch 帳戶的網路存取類型。
如果未指定,預設值為 'enabled'。
|
tags
|
|
object
|
與帳戶相關聯的使用者指定標記。
|
回應
名稱 |
類型 |
Description |
200 OK
|
BatchAccount
|
作業成功。 回應包含 Batch 帳戶實體。
|
202 Accepted
|
|
作業將會以異步方式完成。
Headers
- Location: string
- Retry-After: integer
|
Other Status Codes
|
CloudError
|
描述作業失敗原因的錯誤回應。
|
安全性
azure_auth
Microsoft Entra OAuth 2.0 驗證碼流程
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名稱 |
Description |
user_impersonation
|
模擬您的用戶帳戶
|
範例
BatchAccountCreate_BYOS
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct?api-version=2024-02-01
{
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
},
"poolAllocationMode": "UserSubscription",
"keyVaultReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
"url": "http://sample.vault.azure.net/"
}
}
}
import com.azure.resourcemanager.batch.models.AutoStorageBaseProperties;
import com.azure.resourcemanager.batch.models.KeyVaultReference;
import com.azure.resourcemanager.batch.models.PoolAllocationMode;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for BatchAccount Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_BYOS.json
*/
/**
* Sample code: BatchAccountCreate_BYOS.
*
* @param manager Entry point to BatchManager.
*/
public static void batchAccountCreateBYOS(com.azure.resourcemanager.batch.BatchManager manager) {
manager.batchAccounts().define("sampleacct").withRegion("japaneast")
.withExistingResourceGroup("default-azurebatch-japaneast")
.withAutoStorage(new AutoStorageBaseProperties().withStorageAccountId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"))
.withPoolAllocationMode(PoolAllocationMode.USER_SUBSCRIPTION)
.withKeyVaultReference(new KeyVaultReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample")
.withUrl("http://sample.vault.azure.net/"))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python batch_account_create_byos.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.batch_account.begin_create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
parameters={
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
},
"keyVaultReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
"url": "http://sample.vault.azure.net/",
},
"poolAllocationMode": "UserSubscription",
},
},
).result()
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_BYOS.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/BatchAccountCreate_BYOS.json
func ExampleAccountClient_BeginCreate_batchAccountCreateByos() {
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)
}
poller, err := clientFactory.NewAccountClient().BeginCreate(ctx, "default-azurebatch-japaneast", "sampleacct", armbatch.AccountCreateParameters{
Location: to.Ptr("japaneast"),
Properties: &armbatch.AccountCreateProperties{
AutoStorage: &armbatch.AutoStorageBaseProperties{
StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
},
KeyVaultReference: &armbatch.KeyVaultReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample"),
URL: to.Ptr("http://sample.vault.azure.net/"),
},
PoolAllocationMode: to.Ptr(armbatch.PoolAllocationModeUserSubscription),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.Account = armbatch.Account{
// Name: to.Ptr("sampleacct"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct"),
// Location: to.Ptr("japaneast"),
// Identity: &armbatch.AccountIdentity{
// Type: to.Ptr(armbatch.ResourceIdentityTypeNone),
// },
// Properties: &armbatch.AccountProperties{
// AccountEndpoint: to.Ptr("sampleacct.japaneast.batch.azure.com"),
// ActiveJobAndJobScheduleQuota: to.Ptr[int32](20),
// AutoStorage: &armbatch.AutoStorageProperties{
// StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
// LastKeySync: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-10T23:48:38.987Z"); return t}()),
// },
// DedicatedCoreQuota: to.Ptr[int32](20),
// KeyVaultReference: &armbatch.KeyVaultReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample"),
// URL: to.Ptr("http://sample.vault.azure.net/"),
// },
// LowPriorityCoreQuota: to.Ptr[int32](20),
// PoolAllocationMode: to.Ptr(armbatch.PoolAllocationModeUserSubscription),
// PoolQuota: to.Ptr[int32](20),
// ProvisioningState: to.Ptr(armbatch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armbatch.PublicNetworkAccessTypeEnabled),
// },
// }
}
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 Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
*
* @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_BYOS.json
*/
async function batchAccountCreateByos() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const parameters = {
autoStorage: {
storageAccountId:
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
},
keyVaultReference: {
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
url: "http://sample.vault.azure.net/",
},
location: "japaneast",
poolAllocationMode: "UserSubscription",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.batchAccountOperations.beginCreateAndWait(
resourceGroupName,
accountName,
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.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_BYOS.json
// this example is just showing the usage of "BatchAccount_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this BatchAccountResource
BatchAccountCollection collection = resourceGroupResource.GetBatchAccounts();
// invoke the operation
string accountName = "sampleacct";
BatchAccountCreateOrUpdateContent content = new BatchAccountCreateOrUpdateContent(new AzureLocation("japaneast"))
{
AutoStorage = new BatchAccountAutoStorageBaseConfiguration(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage")),
PoolAllocationMode = BatchAccountPoolAllocationMode.UserSubscription,
KeyVaultReference = new BatchKeyVaultReference(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample"), new Uri("http://sample.vault.azure.net/")),
};
ArmOperation<BatchAccountResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content);
BatchAccountResource 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
BatchAccountData 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
{
"name": "sampleacct",
"location": "japaneast",
"properties": {
"accountEndpoint": "sampleacct.japaneast.batch.azure.com",
"provisioningState": "Succeeded",
"poolAllocationMode": "UserSubscription",
"dedicatedCoreQuota": 20,
"lowPriorityCoreQuota": 20,
"poolQuota": 20,
"activeJobAndJobScheduleQuota": 20,
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
"lastKeySync": "2016-03-10T23:48:38.9878479Z"
},
"keyVaultReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
"url": "http://sample.vault.azure.net/"
},
"publicNetworkAccess": "Enabled"
},
"identity": {
"type": "None"
},
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct",
"type": "Microsoft.Batch/batchAccounts"
}
BatchAccountCreate_Default
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct?api-version=2024-02-01
{
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
}
}
}
import com.azure.resourcemanager.batch.models.AutoStorageBaseProperties;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for BatchAccount Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_Default.json
*/
/**
* Sample code: BatchAccountCreate_Default.
*
* @param manager Entry point to BatchManager.
*/
public static void batchAccountCreateDefault(com.azure.resourcemanager.batch.BatchManager manager) {
manager.batchAccounts().define("sampleacct").withRegion("japaneast")
.withExistingResourceGroup("default-azurebatch-japaneast")
.withAutoStorage(new AutoStorageBaseProperties().withStorageAccountId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python batch_account_create_default.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.batch_account.begin_create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
parameters={
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
}
},
},
).result()
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_Default.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/BatchAccountCreate_Default.json
func ExampleAccountClient_BeginCreate_batchAccountCreateDefault() {
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)
}
poller, err := clientFactory.NewAccountClient().BeginCreate(ctx, "default-azurebatch-japaneast", "sampleacct", armbatch.AccountCreateParameters{
Location: to.Ptr("japaneast"),
Properties: &armbatch.AccountCreateProperties{
AutoStorage: &armbatch.AutoStorageBaseProperties{
StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.Account = armbatch.Account{
// Name: to.Ptr("sampleacct"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct"),
// Location: to.Ptr("japaneast"),
// Identity: &armbatch.AccountIdentity{
// Type: to.Ptr(armbatch.ResourceIdentityTypeNone),
// },
// Properties: &armbatch.AccountProperties{
// AccountEndpoint: to.Ptr("sampleacct.japaneast.batch.azure.com"),
// ActiveJobAndJobScheduleQuota: to.Ptr[int32](20),
// AutoStorage: &armbatch.AutoStorageProperties{
// StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
// LastKeySync: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-10T23:48:38.987Z"); return t}()),
// },
// DedicatedCoreQuota: to.Ptr[int32](20),
// LowPriorityCoreQuota: to.Ptr[int32](20),
// PoolAllocationMode: to.Ptr(armbatch.PoolAllocationModeBatchService),
// PoolQuota: to.Ptr[int32](20),
// ProvisioningState: to.Ptr(armbatch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armbatch.PublicNetworkAccessTypeEnabled),
// },
// }
}
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 Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
*
* @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_Default.json
*/
async function batchAccountCreateDefault() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const parameters = {
autoStorage: {
storageAccountId:
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
},
location: "japaneast",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.batchAccountOperations.beginCreateAndWait(
resourceGroupName,
accountName,
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.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_Default.json
// this example is just showing the usage of "BatchAccount_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this BatchAccountResource
BatchAccountCollection collection = resourceGroupResource.GetBatchAccounts();
// invoke the operation
string accountName = "sampleacct";
BatchAccountCreateOrUpdateContent content = new BatchAccountCreateOrUpdateContent(new AzureLocation("japaneast"))
{
AutoStorage = new BatchAccountAutoStorageBaseConfiguration(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage")),
};
ArmOperation<BatchAccountResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content);
BatchAccountResource 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
BatchAccountData 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
{
"name": "sampleacct",
"location": "japaneast",
"properties": {
"accountEndpoint": "sampleacct.japaneast.batch.azure.com",
"provisioningState": "Succeeded",
"poolAllocationMode": "BatchService",
"dedicatedCoreQuota": 20,
"lowPriorityCoreQuota": 20,
"poolQuota": 20,
"activeJobAndJobScheduleQuota": 20,
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
"lastKeySync": "2016-03-10T23:48:38.9878479Z"
},
"publicNetworkAccess": "Enabled"
},
"identity": {
"type": "None"
},
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct",
"type": "Microsoft.Batch/batchAccounts"
}
BatchAccountCreate_SystemAssignedIdentity
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct?api-version=2024-02-01
{
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
}
},
"identity": {
"type": "SystemAssigned"
}
}
import com.azure.resourcemanager.batch.models.AutoStorageBaseProperties;
import com.azure.resourcemanager.batch.models.BatchAccountIdentity;
import com.azure.resourcemanager.batch.models.ResourceIdentityType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for BatchAccount Create.
*/
public final class Main {
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* BatchAccountCreate_SystemAssignedIdentity.json
*/
/**
* Sample code: BatchAccountCreate_SystemAssignedIdentity.
*
* @param manager Entry point to BatchManager.
*/
public static void batchAccountCreateSystemAssignedIdentity(com.azure.resourcemanager.batch.BatchManager manager) {
manager.batchAccounts().define("sampleacct").withRegion("japaneast")
.withExistingResourceGroup("default-azurebatch-japaneast")
.withIdentity(new BatchAccountIdentity().withType(ResourceIdentityType.SYSTEM_ASSIGNED))
.withAutoStorage(new AutoStorageBaseProperties().withStorageAccountId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python batch_account_create_system_assigned_identity.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.batch_account.begin_create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
parameters={
"identity": {"type": "SystemAssigned"},
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
}
},
},
).result()
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_SystemAssignedIdentity.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/BatchAccountCreate_SystemAssignedIdentity.json
func ExampleAccountClient_BeginCreate_batchAccountCreateSystemAssignedIdentity() {
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)
}
poller, err := clientFactory.NewAccountClient().BeginCreate(ctx, "default-azurebatch-japaneast", "sampleacct", armbatch.AccountCreateParameters{
Identity: &armbatch.AccountIdentity{
Type: to.Ptr(armbatch.ResourceIdentityTypeSystemAssigned),
},
Location: to.Ptr("japaneast"),
Properties: &armbatch.AccountCreateProperties{
AutoStorage: &armbatch.AutoStorageBaseProperties{
StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.Account = armbatch.Account{
// Name: to.Ptr("sampleacct"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct"),
// Location: to.Ptr("japaneast"),
// Identity: &armbatch.AccountIdentity{
// Type: to.Ptr(armbatch.ResourceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("1a2e532b-9900-414c-8600-cfc6126628d7"),
// TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"),
// },
// Properties: &armbatch.AccountProperties{
// AccountEndpoint: to.Ptr("sampleacct.japaneast.batch.azure.com"),
// ActiveJobAndJobScheduleQuota: to.Ptr[int32](20),
// AutoStorage: &armbatch.AutoStorageProperties{
// StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
// LastKeySync: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-10T23:48:38.987Z"); return t}()),
// },
// DedicatedCoreQuota: to.Ptr[int32](20),
// LowPriorityCoreQuota: to.Ptr[int32](20),
// PoolAllocationMode: to.Ptr(armbatch.PoolAllocationModeBatchService),
// PoolQuota: to.Ptr[int32](20),
// ProvisioningState: to.Ptr(armbatch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armbatch.PublicNetworkAccessTypeEnabled),
// },
// }
}
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 Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
*
* @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_SystemAssignedIdentity.json
*/
async function batchAccountCreateSystemAssignedIdentity() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const parameters = {
autoStorage: {
storageAccountId:
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
},
identity: { type: "SystemAssigned" },
location: "japaneast",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.batchAccountOperations.beginCreateAndWait(
resourceGroupName,
accountName,
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.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_SystemAssignedIdentity.json
// this example is just showing the usage of "BatchAccount_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this BatchAccountResource
BatchAccountCollection collection = resourceGroupResource.GetBatchAccounts();
// invoke the operation
string accountName = "sampleacct";
BatchAccountCreateOrUpdateContent content = new BatchAccountCreateOrUpdateContent(new AzureLocation("japaneast"))
{
Identity = new ManagedServiceIdentity("SystemAssigned"),
AutoStorage = new BatchAccountAutoStorageBaseConfiguration(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage")),
};
ArmOperation<BatchAccountResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content);
BatchAccountResource 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
BatchAccountData 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
{
"name": "sampleacct",
"location": "japaneast",
"properties": {
"accountEndpoint": "sampleacct.japaneast.batch.azure.com",
"provisioningState": "Succeeded",
"poolAllocationMode": "BatchService",
"dedicatedCoreQuota": 20,
"lowPriorityCoreQuota": 20,
"poolQuota": 20,
"activeJobAndJobScheduleQuota": 20,
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
"lastKeySync": "2016-03-10T23:48:38.9878479Z"
},
"publicNetworkAccess": "Enabled"
},
"identity": {
"principalId": "1a2e532b-9900-414c-8600-cfc6126628d7",
"tenantId": "f686d426-8d16-42db-81b7-ab578e110ccd",
"type": "SystemAssigned"
},
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct",
"type": "Microsoft.Batch/batchAccounts"
}
BatchAccountCreate_UserAssignedIdentity
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct?api-version=2024-02-01
{
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
}
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}
}
}
}
import com.azure.resourcemanager.batch.models.AutoStorageBaseProperties;
import com.azure.resourcemanager.batch.models.BatchAccountIdentity;
import com.azure.resourcemanager.batch.models.ResourceIdentityType;
import com.azure.resourcemanager.batch.models.UserAssignedIdentities;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for BatchAccount Create.
*/
public final class Main {
/*
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/
* BatchAccountCreate_UserAssignedIdentity.json
*/
/**
* Sample code: BatchAccountCreate_UserAssignedIdentity.
*
* @param manager Entry point to BatchManager.
*/
public static void batchAccountCreateUserAssignedIdentity(com.azure.resourcemanager.batch.BatchManager manager) {
manager.batchAccounts().define("sampleacct").withRegion("japaneast")
.withExistingResourceGroup("default-azurebatch-japaneast")
.withIdentity(new BatchAccountIdentity().withType(ResourceIdentityType.USER_ASSIGNED)
.withUserAssignedIdentities(mapOf(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1",
new UserAssignedIdentities())))
.withAutoStorage(new AutoStorageBaseProperties().withStorageAccountId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"))
.create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python batch_account_create_user_assigned_identity.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.batch_account.begin_create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
parameters={
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}
},
},
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
}
},
},
).result()
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_UserAssignedIdentity.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/BatchAccountCreate_UserAssignedIdentity.json
func ExampleAccountClient_BeginCreate_batchAccountCreateUserAssignedIdentity() {
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)
}
poller, err := clientFactory.NewAccountClient().BeginCreate(ctx, "default-azurebatch-japaneast", "sampleacct", armbatch.AccountCreateParameters{
Identity: &armbatch.AccountIdentity{
Type: to.Ptr(armbatch.ResourceIdentityTypeUserAssigned),
UserAssignedIdentities: map[string]*armbatch.UserAssignedIdentities{
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {},
},
},
Location: to.Ptr("japaneast"),
Properties: &armbatch.AccountCreateProperties{
AutoStorage: &armbatch.AutoStorageBaseProperties{
StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.Account = armbatch.Account{
// Name: to.Ptr("sampleacct"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct"),
// Location: to.Ptr("japaneast"),
// Identity: &armbatch.AccountIdentity{
// Type: to.Ptr(armbatch.ResourceIdentityTypeUserAssigned),
// 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"),
// },
// },
// },
// Properties: &armbatch.AccountProperties{
// AccountEndpoint: to.Ptr("sampleacct.japaneast.batch.azure.com"),
// ActiveJobAndJobScheduleQuota: to.Ptr[int32](20),
// AutoStorage: &armbatch.AutoStorageProperties{
// StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
// LastKeySync: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-10T23:48:38.987Z"); return t}()),
// },
// DedicatedCoreQuota: to.Ptr[int32](20),
// LowPriorityCoreQuota: to.Ptr[int32](20),
// PoolAllocationMode: to.Ptr(armbatch.PoolAllocationModeBatchService),
// PoolQuota: to.Ptr[int32](20),
// ProvisioningState: to.Ptr(armbatch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armbatch.PublicNetworkAccessTypeEnabled),
// },
// }
}
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 Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
*
* @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_UserAssignedIdentity.json
*/
async function batchAccountCreateUserAssignedIdentity() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const parameters = {
autoStorage: {
storageAccountId:
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
},
identity: {
type: "UserAssigned",
userAssignedIdentities: {
"/subscriptions/subid/resourceGroups/defaultAzurebatchJapaneast/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1":
{},
},
},
location: "japaneast",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.batchAccountOperations.beginCreateAndWait(
resourceGroupName,
accountName,
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.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/BatchAccountCreate_UserAssignedIdentity.json
// this example is just showing the usage of "BatchAccount_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this BatchAccountResource
BatchAccountCollection collection = resourceGroupResource.GetBatchAccounts();
// invoke the operation
string accountName = "sampleacct";
BatchAccountCreateOrUpdateContent content = new BatchAccountCreateOrUpdateContent(new AzureLocation("japaneast"))
{
Identity = new ManagedServiceIdentity("UserAssigned")
{
UserAssignedIdentities =
{
[new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(),
},
},
AutoStorage = new BatchAccountAutoStorageBaseConfiguration(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage")),
};
ArmOperation<BatchAccountResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content);
BatchAccountResource 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
BatchAccountData 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
{
"name": "sampleacct",
"location": "japaneast",
"properties": {
"accountEndpoint": "sampleacct.japaneast.batch.azure.com",
"provisioningState": "Succeeded",
"poolAllocationMode": "BatchService",
"dedicatedCoreQuota": 20,
"lowPriorityCoreQuota": 20,
"poolQuota": 20,
"activeJobAndJobScheduleQuota": 20,
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
"lastKeySync": "2016-03-10T23:48:38.9878479Z"
},
"publicNetworkAccess": "Enabled"
},
"identity": {
"type": "UserAssigned",
"userAssignedIdentities": {
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {
"principalId": "principalId1",
"clientId": "clientId1"
}
}
},
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct",
"type": "Microsoft.Batch/batchAccounts"
}
PrivateBatchAccountCreate
Sample Request
PUT https://management.azure.com/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct?api-version=2024-02-01
{
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
},
"keyVaultReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
"url": "http://sample.vault.azure.net/"
},
"publicNetworkAccess": "Disabled"
}
}
import com.azure.resourcemanager.batch.models.AutoStorageBaseProperties;
import com.azure.resourcemanager.batch.models.KeyVaultReference;
import com.azure.resourcemanager.batch.models.PublicNetworkAccessType;
import java.util.HashMap;
import java.util.Map;
/**
* Samples for BatchAccount Create.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PrivateBatchAccountCreate.json
*/
/**
* Sample code: PrivateBatchAccountCreate.
*
* @param manager Entry point to BatchManager.
*/
public static void privateBatchAccountCreate(com.azure.resourcemanager.batch.BatchManager manager) {
manager.batchAccounts().define("sampleacct").withRegion("japaneast")
.withExistingResourceGroup("default-azurebatch-japaneast")
.withAutoStorage(new AutoStorageBaseProperties().withStorageAccountId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"))
.withKeyVaultReference(new KeyVaultReference().withId(
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample")
.withUrl("http://sample.vault.azure.net/"))
.withPublicNetworkAccess(PublicNetworkAccessType.DISABLED).create();
}
// Use "Map.of" if available
@SuppressWarnings("unchecked")
private static <T> Map<String, T> mapOf(Object... inputs) {
Map<String, T> map = new HashMap<>();
for (int i = 0; i < inputs.length; i += 2) {
String key = (String) inputs[i];
T value = (T) inputs[i + 1];
map.put(key, value);
}
return map;
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.batch import BatchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-batch
# USAGE
python private_batch_account_create.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.batch_account.begin_create(
resource_group_name="default-azurebatch-japaneast",
account_name="sampleacct",
parameters={
"location": "japaneast",
"properties": {
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"
},
"keyVaultReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
"url": "http://sample.vault.azure.net/",
},
"publicNetworkAccess": "Disabled",
},
},
).result()
print(response)
# x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PrivateBatchAccountCreate.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/PrivateBatchAccountCreate.json
func ExampleAccountClient_BeginCreate_privateBatchAccountCreate() {
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)
}
poller, err := clientFactory.NewAccountClient().BeginCreate(ctx, "default-azurebatch-japaneast", "sampleacct", armbatch.AccountCreateParameters{
Location: to.Ptr("japaneast"),
Properties: &armbatch.AccountCreateProperties{
AutoStorage: &armbatch.AutoStorageBaseProperties{
StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
},
KeyVaultReference: &armbatch.KeyVaultReference{
ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample"),
URL: to.Ptr("http://sample.vault.azure.net/"),
},
PublicNetworkAccess: to.Ptr(armbatch.PublicNetworkAccessTypeDisabled),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %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.Account = armbatch.Account{
// Name: to.Ptr("sampleacct"),
// Type: to.Ptr("Microsoft.Batch/batchAccounts"),
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct"),
// Location: to.Ptr("japaneast"),
// Identity: &armbatch.AccountIdentity{
// Type: to.Ptr(armbatch.ResourceIdentityTypeNone),
// },
// Properties: &armbatch.AccountProperties{
// AccountEndpoint: to.Ptr("sampleacct.japaneast.batch.azure.com"),
// ActiveJobAndJobScheduleQuota: to.Ptr[int32](20),
// AutoStorage: &armbatch.AutoStorageProperties{
// StorageAccountID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage"),
// LastKeySync: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-03-10T23:48:38.987Z"); return t}()),
// },
// DedicatedCoreQuota: to.Ptr[int32](20),
// KeyVaultReference: &armbatch.KeyVaultReference{
// ID: to.Ptr("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample"),
// URL: to.Ptr("http://sample.vault.azure.net/"),
// },
// LowPriorityCoreQuota: to.Ptr[int32](20),
// PoolAllocationMode: to.Ptr(armbatch.PoolAllocationModeUserSubscription),
// PoolQuota: to.Ptr[int32](20),
// ProvisioningState: to.Ptr(armbatch.ProvisioningStateSucceeded),
// PublicNetworkAccess: to.Ptr(armbatch.PublicNetworkAccessTypeDisabled),
// },
// }
}
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 Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
*
* @summary Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and should instead be updated with the Update Batch Account API.
* x-ms-original-file: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PrivateBatchAccountCreate.json
*/
async function privateBatchAccountCreate() {
const subscriptionId = process.env["BATCH_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["BATCH_RESOURCE_GROUP"] || "default-azurebatch-japaneast";
const accountName = "sampleacct";
const parameters = {
autoStorage: {
storageAccountId:
"/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
},
keyVaultReference: {
id: "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
url: "http://sample.vault.azure.net/",
},
location: "japaneast",
publicNetworkAccess: "Disabled",
};
const credential = new DefaultAzureCredential();
const client = new BatchManagementClient(credential, subscriptionId);
const result = await client.batchAccountOperations.beginCreateAndWait(
resourceGroupName,
accountName,
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.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Batch;
using Azure.ResourceManager.Batch.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/batch/resource-manager/Microsoft.Batch/stable/2024-02-01/examples/PrivateBatchAccountCreate.json
// this example is just showing the usage of "BatchAccount_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 ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "subid";
string resourceGroupName = "default-azurebatch-japaneast";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this BatchAccountResource
BatchAccountCollection collection = resourceGroupResource.GetBatchAccounts();
// invoke the operation
string accountName = "sampleacct";
BatchAccountCreateOrUpdateContent content = new BatchAccountCreateOrUpdateContent(new AzureLocation("japaneast"))
{
AutoStorage = new BatchAccountAutoStorageBaseConfiguration(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage")),
KeyVaultReference = new BatchKeyVaultReference(new ResourceIdentifier("/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample"), new Uri("http://sample.vault.azure.net/")),
PublicNetworkAccess = BatchPublicNetworkAccess.Disabled,
};
ArmOperation<BatchAccountResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, content);
BatchAccountResource 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
BatchAccountData 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
{
"name": "sampleacct",
"location": "japaneast",
"properties": {
"accountEndpoint": "sampleacct.japaneast.batch.azure.com",
"provisioningState": "Succeeded",
"poolAllocationMode": "UserSubscription",
"dedicatedCoreQuota": 20,
"lowPriorityCoreQuota": 20,
"poolQuota": 20,
"activeJobAndJobScheduleQuota": 20,
"autoStorage": {
"storageAccountId": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Storage/storageAccounts/samplestorage",
"lastKeySync": "2016-03-10T23:48:38.9878479Z"
},
"keyVaultReference": {
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.KeyVault/vaults/sample",
"url": "http://sample.vault.azure.net/"
},
"publicNetworkAccess": "Disabled"
},
"identity": {
"type": "None"
},
"id": "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.Batch/batchAccounts/sampleacct",
"type": "Microsoft.Batch/batchAccounts"
}
定義
AuthenticationMode
Batch 帳戶的驗證模式。
名稱 |
類型 |
Description |
AAD
|
string
|
使用 Microsoft Entra ID的驗證模式。
|
SharedKey
|
string
|
使用共用金鑰的驗證模式。
|
TaskAuthenticationToken
|
string
|
使用工作驗證令牌的驗證模式。
|
AutoStorageAuthenticationMode
Batch 服務將用來管理自動記憶體帳戶的驗證模式。
名稱 |
類型 |
Description |
BatchAccountManagedIdentity
|
string
|
Batch 服務會使用指派給 Batch 帳戶的受控識別來驗證對自動記憶體的要求。
|
StorageKeys
|
string
|
Batch 服務會使用記憶體帳戶密鑰來驗證自動記憶體的要求。
|
AutoStorageBaseProperties
與自動記憶體帳戶相關的屬性。
名稱 |
類型 |
預設值 |
Description |
authenticationMode
|
AutoStorageAuthenticationMode
|
StorageKeys
|
Batch 服務將用來管理自動記憶體帳戶的驗證模式。
|
nodeIdentityReference
|
ComputeNodeIdentityReference
|
|
使用者指派的身分識別參考,計算節點將用來存取自動記憶體。
此處參考的身分識別必須指派給具有需要自動記憶體存取權之計算節點的集區。
|
storageAccountId
|
string
|
|
要用於自動記憶體帳戶之記憶體帳戶的記憶體帳戶的資源識別碼。
|
AutoStorageProperties
包含與 Batch 帳戶相關聯的自動記憶體帳戶相關信息。
名稱 |
類型 |
預設值 |
Description |
authenticationMode
|
AutoStorageAuthenticationMode
|
StorageKeys
|
Batch 服務將用來管理自動記憶體帳戶的驗證模式。
|
lastKeySync
|
string
|
|
上次與 Batch 帳戶同步處理的記憶體金鑰的 UTC 時間。
|
nodeIdentityReference
|
ComputeNodeIdentityReference
|
|
使用者指派的身分識別參考,計算節點將用來存取自動記憶體。
此處參考的身分識別必須指派給具有需要自動記憶體存取權之計算節點的集區。
|
storageAccountId
|
string
|
|
要用於自動記憶體帳戶之記憶體帳戶的記憶體帳戶的資源識別碼。
|
BatchAccount
包含 Azure Batch 帳戶的相關信息。
名稱 |
類型 |
預設值 |
Description |
id
|
string
|
|
資源的標識碼。
|
identity
|
BatchAccountIdentity
|
|
Batch 帳戶的身分識別。
|
location
|
string
|
|
資源的位置。
|
name
|
string
|
|
資源名稱。
|
properties.accountEndpoint
|
string
|
|
用來與 Batch 服務互動的帳戶端點。
|
properties.activeJobAndJobScheduleQuota
|
integer
|
|
Batch 帳戶的作用中作業和作業排程配額。
|
properties.allowedAuthenticationModes
|
AuthenticationMode[]
|
|
Batch 帳戶允許的驗證模式清單,可用來向數據平面進行驗證。 這不會影響控制平面的驗證。
|
properties.autoStorage
|
AutoStorageProperties
|
|
與 Batch 帳戶相關聯的任何自動記憶體帳戶的屬性和狀態。
包含與 Batch 帳戶相關聯的自動記憶體帳戶相關信息。
|
properties.dedicatedCoreQuota
|
integer
|
|
Batch 帳戶的專用核心配額。
對於將PoolAllocationMode 設定為UserSubscription的帳戶,系統會在訂用帳戶上管理配額,因此不會傳回此值。
|
properties.dedicatedCoreQuotaPerVMFamily
|
VirtualMachineFamilyCoreQuota[]
|
|
Batch 帳戶的每個虛擬機系列專用核心配額清單。 對於將PoolAllocationMode 設定為UserSubscription的帳戶,系統會在訂用帳戶上管理配額,因此不會傳回此值。
|
properties.dedicatedCoreQuotaPerVMFamilyEnforced
|
boolean
|
|
值,指出是否針對此帳戶強制執行每個虛擬機系列的核心配額
如果此旗標為 true,則會透過帳戶上的 dedicatedCoreQuotaPerVMFamily 和 dedicatedCoreQuota 屬性強制執行專用核心配額。 如果此旗標為 false,則專用核心配額只會透過帳戶上的 dedicatedCoreQuota 屬性強制執行,而且不會考慮虛擬機系列。
|
properties.encryption
|
EncryptionProperties
|
|
Batch 帳戶的加密組態。
設定客戶數據在 Batch 帳戶內加密的方式。 根據預設,帳戶會使用 Microsoft 受控金鑰進行加密。 如需其他控制,可以改用客戶管理的密鑰。
|
properties.keyVaultReference
|
KeyVaultReference
|
|
與 Batch 帳戶相關聯的 Azure 金鑰保存庫參考。
識別與 Batch 帳戶相關聯的 Azure 金鑰保存庫。
|
properties.lowPriorityCoreQuota
|
integer
|
|
Batch 帳戶的 Spot/低優先順序核心配額。
對於將PoolAllocationMode 設定為UserSubscription的帳戶,系統會在訂用帳戶上管理配額,因此不會傳回此值。
|
properties.networkProfile
|
NetworkProfile
|
|
Batch 帳戶的網路配置檔,其中包含每個端點的網路規則設定。
只有在啟用 publicNetworkAccess 時,網路配置檔才會生效。
|
properties.nodeManagementEndpoint
|
string
|
|
計算節點用來連線到 Batch 節點管理服務的端點。
|
properties.poolAllocationMode
|
PoolAllocationMode
|
|
在 Batch 帳戶中建立集區所使用的配置模式。
在 Batch 帳戶中建立集區的配置模式。
|
properties.poolQuota
|
integer
|
|
Batch 帳戶的集區配額。
|
properties.privateEndpointConnections
|
PrivateEndpointConnection[]
|
|
與 Batch 帳戶相關聯的私人端點連線清單
|
properties.provisioningState
|
ProvisioningState
|
|
資源的布建狀態
|
properties.publicNetworkAccess
|
PublicNetworkAccessType
|
Enabled
|
用於存取 Azure Batch 服務和 Batch 帳戶作業的網路介面類型。
如果未指定,預設值為 'enabled'。
|
tags
|
object
|
|
資源的標記。
|
type
|
string
|
|
資源類型。
|
BatchAccountCreateParameters
提供給建立作業的參數。
名稱 |
類型 |
預設值 |
Description |
identity
|
BatchAccountIdentity
|
|
Batch 帳戶的身分識別。
|
location
|
string
|
|
要在其中建立帳戶的區域。
|
properties.allowedAuthenticationModes
|
AuthenticationMode[]
|
|
Batch 帳戶允許的驗證模式清單,可用來向數據平面進行驗證。 這不會影響控制平面的驗證。
|
properties.autoStorage
|
AutoStorageBaseProperties
|
|
與自動記憶體帳戶相關的屬性。
|
properties.encryption
|
EncryptionProperties
|
|
Batch 帳戶的加密組態。
設定客戶數據在 Batch 帳戶內加密的方式。 根據預設,帳戶會使用 Microsoft 受控金鑰進行加密。 如需其他控制,可以改用客戶管理的密鑰。
|
properties.keyVaultReference
|
KeyVaultReference
|
|
與 Batch 帳戶相關聯的 Azure 金鑰保存庫參考。
|
properties.networkProfile
|
NetworkProfile
|
|
Batch 帳戶的網路配置檔,其中包含每個端點的網路規則設定。
只有在啟用 publicNetworkAccess 時,網路配置檔才會生效。
|
properties.poolAllocationMode
|
PoolAllocationMode
|
|
在 Batch 帳戶中建立集區所使用的配置模式。
集區配置模式也會影響用戶端如何向 Batch 服務 API 進行驗證。 如果模式為 BatchService,用戶端可以使用存取金鑰或 Microsoft Entra ID 進行驗證。 如果模式為 UserSubscription,客戶端必須使用 Microsoft Entra ID。 預設值為 BatchService。
|
properties.publicNetworkAccess
|
PublicNetworkAccessType
|
Enabled
|
用於存取 Azure Batch 帳戶的網路存取類型。
如果未指定,預設值為 'enabled'。
|
tags
|
object
|
|
與帳戶相關聯的使用者指定標記。
|
BatchAccountIdentity
如果已設定,則為 Batch 帳戶的身分識別。 當使用者將 『Microsoft.KeyVault』 指定為其 Batch 帳戶加密組態,或選取為自動儲存驗證模式時 ManagedIdentity
,就會使用此選項。
名稱 |
類型 |
Description |
principalId
|
string
|
Batch 帳戶的主體標識碼。 此屬性只會針對系統指派的身分識別提供。
|
tenantId
|
string
|
與 Batch 帳戶相關聯的租用戶標識碼。 此屬性只會針對系統指派的身分識別提供。
|
type
|
ResourceIdentityType
|
用於 Batch 帳戶的身分識別類型。
|
userAssignedIdentities
|
object
|
與 Batch 帳戶相關聯的使用者身分識別清單。
|
CloudError
Batch 服務的錯誤回應。
名稱 |
類型 |
Description |
error
|
CloudErrorBody
|
錯誤回應的本文。
|
CloudErrorBody
Batch 服務的錯誤回應。
名稱 |
類型 |
Description |
code
|
string
|
錯誤的識別碼。 程式碼不變,且要以程式設計方式使用。
|
details
|
CloudErrorBody[]
|
錯誤的其他詳細數據清單。
|
message
|
string
|
描述錯誤的訊息,適用於在使用者介面中顯示。
|
target
|
string
|
特定錯誤的目標。 例如,錯誤中的屬性名稱。
|
ComputeNodeIdentityReference
與計算節點將使用之 Batch 集區相關聯的使用者指派身分識別參考。
名稱 |
類型 |
Description |
resourceId
|
string
|
使用者指派身分識別的 ARM 資源識別碼。
|
EncryptionProperties
設定客戶數據在 Batch 帳戶內加密的方式。 根據預設,帳戶會使用 Microsoft 受控金鑰進行加密。 如需其他控制,可以改用客戶管理的密鑰。
名稱 |
類型 |
Description |
keySource
|
KeySource
|
金鑰來源的類型。
|
keyVaultProperties
|
KeyVaultProperties
|
使用 Microsoft.KeyVault 時的其他詳細數據
|
EndpointAccessDefaultAction
沒有相符 IPRule 時的預設動作。
名稱 |
類型 |
Description |
Allow
|
string
|
允許用戶端存取。
|
Deny
|
string
|
拒絕用戶端存取。
|
EndpointAccessProfile
Batch 端點的網路存取配置檔。
名稱 |
類型 |
Description |
defaultAction
|
EndpointAccessDefaultAction
|
沒有相符 IPRule 時的預設動作。
端點存取的預設動作。 只有在啟用 publicNetworkAccess 時才適用。
|
ipRules
|
IPRule[]
|
要篩選用戶端 IP 位址的 IP 範圍數位。
|
IPRule
篩選用戶端 IP 位址的規則。
名稱 |
類型 |
Description |
action
|
IPRuleAction
|
比對用戶端IP位址時的動作。
|
value
|
string
|
要篩選的IP位址或IP位址範圍
IPv4 位址或 CIDR 格式的 IPv4 位址範圍。
|
IPRuleAction
比對用戶端IP位址時的動作。
名稱 |
類型 |
Description |
Allow
|
string
|
允許存取相符的用戶端IP位址。
|
KeySource
金鑰來源的類型。
名稱 |
類型 |
Description |
Microsoft.Batch
|
string
|
Batch 會建立和管理用來保護帳戶數據的加密密鑰。
|
Microsoft.KeyVault
|
string
|
用來保護帳戶數據的加密金鑰會儲存在外部金鑰保存庫中。 如果設定此選項,則必須將 Batch 帳戶身分識別設定為 SystemAssigned ,而且也必須在 keyVaultProperties 下提供有效的密鑰標識碼。
|
KeyVaultProperties
使用 Microsoft.KeyVault 的加密金鑰Source 時的 KeyVault 組態。
KeyVaultReference
識別與 Batch 帳戶相關聯的 Azure 金鑰保存庫。
名稱 |
類型 |
Description |
id
|
string
|
與 Batch 帳戶相關的 Azure Key Vault 資源識別碼。
|
url
|
string
|
與 Batch 帳戶相關的 Azure Key Vault URL。
|
NetworkProfile
Batch 帳戶的網路配置檔,其中包含每個端點的網路規則設定。
名稱 |
類型 |
Description |
accountAccess
|
EndpointAccessProfile
|
batchAccount 端點的網路存取配置檔 (Batch 帳戶數據平面 API) 。
|
nodeManagementAccess
|
EndpointAccessProfile
|
nodeManagement 端點的網路存取配置檔 (Batch 服務管理 Batch 集區的計算節點) 。
|
PoolAllocationMode
在 Batch 帳戶中建立集區的配置模式。
名稱 |
類型 |
Description |
BatchService
|
string
|
集區將會配置於 Batch 服務所擁有的訂用帳戶中。
|
UserSubscription
|
string
|
集區將會配置在使用者所擁有的訂用帳戶中。
|
PrivateEndpoint
私人端點連線的私人端點。
名稱 |
類型 |
Description |
id
|
string
|
私人端點的 ARM 資源識別碼。 此格式為 /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/privateEndpoints/{privateEndpoint}。
|
PrivateEndpointConnection
包含私人鏈接資源的相關信息。
名稱 |
類型 |
Description |
etag
|
string
|
資源的 ETag,用於並行語句。
|
id
|
string
|
資源的標識碼。
|
name
|
string
|
資源名稱。
|
properties.groupIds
|
string[]
|
私人端點聯機的群組標識碼。
值只有一個且只有一個群組標識符。
|
properties.privateEndpoint
|
PrivateEndpoint
|
私人端點的 ARM 資源識別碼。
私人端點連線的私人端點。
|
properties.privateLinkServiceConnectionState
|
PrivateLinkServiceConnectionState
|
私人端點連線的私人連結服務連線狀態。
私人端點連線的私人連結服務連線狀態
|
properties.provisioningState
|
PrivateEndpointConnectionProvisioningState
|
私人端點聯機的布建狀態。
|
type
|
string
|
資源類型。
|
PrivateEndpointConnectionProvisioningState
私人端點聯機的布建狀態。
名稱 |
類型 |
Description |
Cancelled
|
string
|
使用者已取消連線建立。
|
Creating
|
string
|
正在建立連線。
|
Deleting
|
string
|
線上正在刪除。
|
Failed
|
string
|
使用者要求更新連線且失敗。 您可以重試更新作業。
|
Succeeded
|
string
|
連線狀態為最終狀態,且已準備好在 [狀態] 為 [已核准] 時使用。
|
Updating
|
string
|
使用者已要求更新連線狀態,但更新作業尚未完成。 線上 Batch 帳戶時,您可能不會參考連線。
|
PrivateLinkServiceConnectionState
私人端點連線的私人連結服務連線狀態
名稱 |
類型 |
Description |
actionsRequired
|
string
|
私人連線狀態所需的動作
|
description
|
string
|
私人連線狀態的描述
|
status
|
PrivateLinkServiceConnectionStatus
|
Batch 帳戶的私人端點連線狀態
|
PrivateLinkServiceConnectionStatus
Batch 私人端點連線的狀態
名稱 |
類型 |
Description |
Approved
|
string
|
私人端點連線已核准,可用來存取 Batch 帳戶
|
Disconnected
|
string
|
私人端點連線已中斷連線,無法用來存取 Batch 帳戶
|
Pending
|
string
|
私人端點連線擱置中,無法用來存取 Batch 帳戶
|
Rejected
|
string
|
私人端點連線遭到拒絕,無法用來存取 Batch 帳戶
|
ProvisioningState
資源的布建狀態
名稱 |
類型 |
Description |
Cancelled
|
string
|
取消帳戶的最後一個作業。
|
Creating
|
string
|
正在建立帳戶。
|
Deleting
|
string
|
正在刪除帳戶。
|
Failed
|
string
|
帳戶的最後一個作業失敗。
|
Invalid
|
string
|
帳戶處於無效狀態。
|
Succeeded
|
string
|
帳戶已建立並可供使用。
|
PublicNetworkAccessType
在 Batch 帳戶中的資源上操作的網路存取類型。
名稱 |
類型 |
Description |
Disabled
|
string
|
停用公用連線,並啟用透過私人端點資源 Azure Batch 服務的私人連線。
|
Enabled
|
string
|
允許透過公用 DNS 連線至 Azure Batch。
|
ResourceIdentityType
用於 Batch 帳戶的身分識別類型。
名稱 |
類型 |
Description |
None
|
string
|
Batch 帳戶沒有與其相關聯的身分識別。 更新帳戶中的設定 None 將會移除現有的身分識別。
|
SystemAssigned
|
string
|
Batch 帳戶具有系統指派的身分識別。
|
UserAssigned
|
string
|
Batch 帳戶具有使用者指派的身分識別。
|
UserAssignedIdentities
相關聯的使用者身分識別清單。
名稱 |
類型 |
Description |
clientId
|
string
|
使用者指派身分識別的用戶端標識碼。
|
principalId
|
string
|
使用者指派身分識別的主體標識碼。
|
VirtualMachineFamilyCoreQuota
VM 系列及其 Batch 帳戶的相關核心配額。
名稱 |
類型 |
Description |
coreQuota
|
integer
|
Batch 帳戶 VM 系列的核心配額。
|
name
|
string
|
虛擬機系列名稱。
|