@@ -223,6 +223,38 @@ public String getGalleryResourceGroup() {
223
223
224
224
private static final int GEN_STORAGE_ACCOUNT_UID_LENGTH = 22 ;
225
225
226
+ private static final String VALIDATE_DEPLOYMENT_TEMPLATE_MESSAGE = "Verify configuration:\n \t {0}{1}{2}{3}"
227
+ + "resourceGroupName: {4};\n \t "
228
+ + "templateName: {5};\n \t "
229
+ + "labels: {6};\n \t "
230
+ + "location: {7};\n \t "
231
+ + "virtualMachineSize: {8};\n \t "
232
+ + "storageAccountName: {9};\n \t "
233
+ + "noOfParallelJobs: {10};\n \t "
234
+ + "imageTopLevelType: {11};\n \t "
235
+ + "builtInImage: {12};\n \t "
236
+ + "image: {13};\n \t "
237
+ + "osType: {14};\n \t "
238
+ + "id: {15};\n \t "
239
+ + "publisher: {16};\n \t "
240
+ + "offer: {17};\n \t "
241
+ + "sku: {18};\n \t "
242
+ + "version: {19};\n \t "
243
+ + "sshConfig: {20};\n \t "
244
+ + "initScript: {21};\n \t "
245
+ + "credentialsId: {22};\n \t "
246
+ + "virtualNetworkName: {23};\n \t "
247
+ + "virtualNetworkResourceGroupName: {24};\n \t "
248
+ + "subnetName: {25};\n \t "
249
+ + "privateIP: {26};\n \t "
250
+ + "nsgName: {27};\n \t "
251
+ + "jvmOptions: {28};\n \t "
252
+ + "galleryName: {29}\n \t "
253
+ + "galleryImageDefinition: {30}\n \t "
254
+ + "galleryImageVersion: {31}\n \t "
255
+ + "galleryResourceGroup: {32}\n \t "
256
+ + "gallerySubscriptionId: {33}" ;
257
+
226
258
// General Configuration
227
259
private final String templateName ;
228
260
@@ -321,7 +353,7 @@ public String getGalleryResourceGroup() {
321
353
// If disabled, will not attempt to verify or use
322
354
private boolean templateDisabled ;
323
355
324
- private String templateStatusDetails ;
356
+ private transient String templateStatusDetails ;
325
357
326
358
private transient AzureVMCloud azureCloud ;
327
359
@@ -338,6 +370,7 @@ public String getGalleryResourceGroup() {
338
370
private boolean enableMSI ;
339
371
340
372
private boolean enableUAMI ;
373
+ private boolean useEntraIdForStorageAccount ;
341
374
342
375
private String uamiID ;
343
376
@@ -572,6 +605,15 @@ public void setMaxVirtualMachinesLimit(int maxVirtualMachinesLimit) {
572
605
this .maxVirtualMachinesLimit = maxVirtualMachinesLimit ;
573
606
}
574
607
608
+ public boolean isUseEntraIdForStorageAccount () {
609
+ return useEntraIdForStorageAccount ;
610
+ }
611
+
612
+ @ DataBoundSetter
613
+ public void setUseEntraIdForStorageAccount (boolean useEntraIdForStorageAccount ) {
614
+ this .useEntraIdForStorageAccount = useEntraIdForStorageAccount ;
615
+ }
616
+
575
617
public String getJavaPath () {
576
618
return javaPath ;
577
619
}
@@ -1454,6 +1496,10 @@ public ListBoxModel doFillNsgNameItems(
1454
1496
1455
1497
try {
1456
1498
AzureResourceManager azureClient = AzureResourceManagerCache .get (azureCredentialsId );
1499
+ if (azureClient == null ) {
1500
+ return model ;
1501
+ }
1502
+
1457
1503
String resourceGroupName = AzureVMCloud .getResourceGroupName (
1458
1504
resourceGroupReferenceType , newResourceGroupName , existingResourceGroupName );
1459
1505
PagedIterable <NetworkSecurityGroup > nsgs =
@@ -1634,6 +1680,9 @@ public ListBoxModel doFillExistingStorageAccountNameItems(
1634
1680
1635
1681
try {
1636
1682
AzureResourceManager azureClient = AzureResourceManagerCache .get (azureCredentialsId );
1683
+ if (azureClient == null ) {
1684
+ return model ;
1685
+ }
1637
1686
1638
1687
String resourceGroupName = AzureVMCloud .getResourceGroupName (
1639
1688
resourceGroupReferenceType , newResourceGroupName , existingResourceGroupName );
@@ -1820,6 +1869,8 @@ public FormValidation doVerifyConfiguration(
1820
1869
@ QueryParameter String storageAccountNameReferenceType ,
1821
1870
@ QueryParameter String newStorageAccountName ,
1822
1871
@ QueryParameter String existingStorageAccountName ,
1872
+ @ QueryParameter boolean useEntraIdForStorageAccount ,
1873
+ @ QueryParameter String uamiID ,
1823
1874
@ QueryParameter String storageAccountType ,
1824
1875
@ QueryParameter String noOfParallelJobs ,
1825
1876
@ QueryParameter String imageTopLevelType ,
@@ -1844,7 +1895,8 @@ public FormValidation doVerifyConfiguration(
1844
1895
@ QueryParameter String subnetName ,
1845
1896
@ QueryParameter boolean usePrivateIP ,
1846
1897
@ QueryParameter String nsgName ,
1847
- @ QueryParameter String jvmOptions ) {
1898
+ @ QueryParameter String jvmOptions
1899
+ ) {
1848
1900
Jenkins .get ().checkPermission (Jenkins .ADMINISTER );
1849
1901
1850
1902
ImageReferenceTypeClass image = new ImageReferenceTypeClass (
@@ -1870,38 +1922,7 @@ public FormValidation doVerifyConfiguration(
1870
1922
cloud .getResourceGroupName (), templateName );
1871
1923
}
1872
1924
1873
- LOGGER .log (Level .INFO ,
1874
- "Verify configuration:\n \t {0}{1}{2}{3}"
1875
- + "resourceGroupName: {4};\n \t "
1876
- + "templateName: {5};\n \t "
1877
- + "labels: {6};\n \t "
1878
- + "location: {7};\n \t "
1879
- + "virtualMachineSize: {8};\n \t "
1880
- + "storageAccountName: {9};\n \t "
1881
- + "noOfParallelJobs: {10};\n \t "
1882
- + "imageTopLevelType: {11};\n \t "
1883
- + "builtInImage: {12};\n \t "
1884
- + "image: {13};\n \t "
1885
- + "osType: {14};\n \t "
1886
- + "id: {15};\n \t "
1887
- + "publisher: {16};\n \t "
1888
- + "offer: {17};\n \t "
1889
- + "sku: {18};\n \t "
1890
- + "version: {19};\n \t "
1891
- + "sshConfig: {20};\n \t "
1892
- + "initScript: {21};\n \t "
1893
- + "credentialsId: {22};\n \t "
1894
- + "virtualNetworkName: {23};\n \t "
1895
- + "virtualNetworkResourceGroupName: {24};\n \t "
1896
- + "subnetName: {25};\n \t "
1897
- + "privateIP: {26};\n \t "
1898
- + "nsgName: {27};\n \t "
1899
- + "jvmOptions: {28};\n \t "
1900
- + "galleryName: {29}\n \t "
1901
- + "galleryImageDefinition: {30}\n \t "
1902
- + "galleryImageVersion: {31}\n \t "
1903
- + "galleryResourceGroup: {32}\n \t "
1904
- + "gallerySubscriptionId: {33}" ,
1925
+ LOGGER .log (Level .INFO , VALIDATE_DEPLOYMENT_TEMPLATE_MESSAGE ,
1905
1926
new Object []{
1906
1927
"" ,
1907
1928
"" ,
@@ -1946,6 +1967,13 @@ public FormValidation doVerifyConfiguration(
1946
1967
return FormValidation .error (result );
1947
1968
}
1948
1969
1970
+ if (useEntraIdForStorageAccount ) {
1971
+ if (StringUtils .isBlank (uamiID )) {
1972
+ return FormValidation .error ("If using Entra ID authentication for storage account "
1973
+ + "user assigned managed identity must be enabled as well." );
1974
+ }
1975
+ }
1976
+
1949
1977
AzureSSHLauncher azureComputerLauncher = new AzureSSHLauncher ();
1950
1978
if (StringUtils .isNotBlank (sshConfig )) {
1951
1979
azureComputerLauncher .setSshConfig (sshConfig );
0 commit comments