Edit: I just realised that AccountName, below, refers to a storage account, which I have not yet created. I thought it was just the general azure "Account", that I have. Disappointing.
I am working through this Java/Azure File Storage example. I have been met with a problem, which I have been unable to find a resolution for:
In English: https://docs.microsoft.com/en-us/azure/storage/files/storage-java-how-to-use-file-storage?tabs=java
createFileShare exception: java.net.UnknownHostException: failed to resolve 'my-provided-accountname.file.core.windows.net' after 2 queries
I am unsure of what exactly to provide for AccountName and, to a lesser extent, AccountKey, which I think is correct.
My obfiscated code:
public static final String connectStr =
"DefaultEndpointsProtocol=https;" +
"AccountName=my-provided-accountname;" +
"AccountKey=87D2A2E999180C4A624E1A8153CEBD6";
public static void main(String[] args) {
SpringApplication.run(AzureFileStorageApplication.class, args);
ShareClient shareClient = new ShareClientBuilder()
.connectionString(connectStr).shareName("testfilestorage")
.buildClient();
createFileShare(connectStr,"hello1A");
}
public static Boolean createFileShare(String connectStr, String shareName)
{
try
{
ShareClient shareClient = new ShareClientBuilder()
.connectionString(connectStr).shareName(shareName)
.buildClient();
shareClient.create();
System.out.println(shareClient);
return true;
}
catch (Exception e)
{
System.out.println("createFileShare exception: " + e.getMessage());
return false;
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…