简体   繁体   中英

Azure Storage Java API: Check if storage account support secure transfer or not using java SDK

I have two storage accounts. One supports Secure transfer and the other is normal storage account.

I want to check in java which storage require secure storage transfer. So that I can put a check in code to use storage connection string using https:// or http://.

You will need to use Azure Management Libraries for Java for that purpose. Using this SDK, you will need to list storage accounts in your Azure Subscription.

Each storage account object should have a property called enableHttpsTrafficOnly that will tell you if you can connect to your storage account using https only (when the value is true) or if you can connect to your storage account using either https or http (when the value is false).

Unfortunately I haven't worked with this library hence not able to post the code.

If you want to check whether your Azure storage account enables "Secure transfer required", you can use PowerShell to check it. For more details, please https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/storage/common/storage-require-secure-transfer.md .

Connect-AzAccount -Tenant "you tenant id"
Get-AzStorageAccount | Select ResourceGroupName,StorageAccountName, EnableHttpsTrafficOnly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM