Skip to content

Commit 70bbbca

Browse files
committed
Updated Javascript azure batch sample file
1 parent 2d20ce7 commit 70bbbca

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

JavaScript/Node.js/sample.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ const batchAccountKey = '<batch-account-key>';
66
const batchEndpoint = '<batch-account-url>';
77

88
// Replace values with SAS URIs of the shell script file
9-
const sh_url = "https://batchdevsgsa.blob.core.windows.net/downloads/startup_prereq.sh?st=2017-04-10T18%3A11%3A00Z&se=2020-03-11T18%3A11%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=xxxx";
9+
const sh_url = "<startup prereq script SAS URI>";
1010

1111
// Replace values with SAS URIs of the Python script file
12-
const scriptURI = "https://batchdevsgsa.blob.core.windows.net/downloads/processcsv.py?st=2017-04-10T18%3A11%3A00Z&se=2020-03-11T18%3A11%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=xxxx";
12+
const scriptURI = "<python script SAS URI>";
1313

1414

1515
const credentials = new BatchSharedKeyCredentials(batchAccountName, batchAccountKey);
@@ -26,13 +26,13 @@ const jobId = "processcsvjob";
2626
const imgRef = {
2727
publisher: "Canonical",
2828
offer: "UbuntuServer",
29-
sku: "16.04-LTS",
29+
sku: "18.04-LTS",
3030
version: "latest"
3131
}
3232
// Pool VM configuraion object
3333
const vmConfig = {
3434
imageReference: imgRef,
35-
nodeAgentSKUId: "batch.node.ubuntu 16.04"
35+
nodeAgentSKUId: "batch.node.ubuntu 18.04"
3636
};
3737
// Number of VMs to create in a pool
3838
const numVms = 4;
@@ -67,7 +67,13 @@ function createJob() {
6767
id: "installprereq",
6868
commandLine: "sudo sh startup_prereq.sh > startup.log",
6969
resourceFiles: [{ 'httpUrl': sh_url, 'filePath': 'startup_prereq.sh' }],
70-
waitForSuccess: true, runElevated: true
70+
waitForSuccess: true, runElevated: true,
71+
userIdentity: {
72+
autoUser: {
73+
elevationLevel: "admin",
74+
scope: "pool"
75+
}
76+
}
7177
};
7278

7379
// Setting Batch Pool ID
@@ -95,7 +101,7 @@ function createJob() {
95101

96102
function createTasks() {
97103
console.log("Creating tasks....");
98-
const containerList = ["con1", "con2", "con3", "con4"];
104+
const containerList = ["con1", "con2", "con3", "con4"]; //Replace with list of blob containers within storage account
99105
containerList.forEach(function (val, index) {
100106
console.log("Submitting task for container : " + val);
101107
const containerName = val;

0 commit comments

Comments
 (0)