Skip to content

Commit 4e8954a

Browse files
t-rufangFlanker32
authored andcommitted
Fix job failure when using default blob storage account's credential for job upload storage
1 parent 1a8f612 commit 4e8954a

File tree

2 files changed

+11
-0
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/spark/run
  • Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/common

2 files changed

+11
-0
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/hdinsight/spark/run/SparkBatchJobRunner.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ protected SparkSubmissionParameter updateStorageConfigForSubmissionParameter(Spa
9393
? new SparkConfigures(existingConfigEntry)
9494
: new SparkConfigures();
9595
wrappedConfig.put("spark.hadoop." + fsRoot.getHadoopBlobFsPropertyKey(), storageKey);
96+
// We need the following config to fix issue https://github.com/microsoft/azure-tools-for-java/issues/5002
97+
wrappedConfig.put("spark.hadoop." + fsRoot.getKeyProviderPropertyKey(), fsRoot.getDefaultKeyProviderPropertyValue());
9698
submissionParameter.getJobConfig().put(SparkSubmissionParameter.Conf, wrappedConfig);
9799
} catch (final UnknownFormatConversionException error) {
98100
final String errorHint = "Azure blob storage uploading path is not in correct format";

Utils/hdinsight-node-common/src/com/microsoft/azure/hdinsight/common/WasbUri.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public final class WasbUri extends AzureStorageUri {
2525
"^http[s]?://(?<storageAccount>[^/.]+)\\.blob\\.(?<endpointSuffix>[^/]+)/(?<container>[^/.]+)"
2626
+ "(:(?<port>[0-9]+))?(/(?<path>.*))?$",
2727
Pattern.CASE_INSENSITIVE);
28+
public static final String SIMPLE_KEY_PROVIDER = "org.apache.hadoop.fs.azure.SimpleKeyProvider";
2829

2930
private final LaterInit<String> container = new LaterInit<>();
3031
private final LaterInit<String> storageAccount = new LaterInit<>();
@@ -76,6 +77,14 @@ public String getHadoopBlobFsPropertyKey() {
7677
return String.format("fs.azure.account.key.%s.blob.%s", getStorageAccount(), getEndpointSuffix());
7778
}
7879

80+
public String getKeyProviderPropertyKey() {
81+
return String.format("fs.azure.account.keyprovider.%s.blob.%s", getStorageAccount(), getEndpointSuffix());
82+
}
83+
84+
public String getDefaultKeyProviderPropertyValue() {
85+
return SIMPLE_KEY_PROVIDER;
86+
}
87+
7988
public static WasbUri parse(final String blobUri) {
8089
Matcher matcher;
8190
if (StringUtils.startsWithIgnoreCase(blobUri, "wasb")) {

0 commit comments

Comments
 (0)