简体   繁体   English

检查 azure 存储帐户中是否启用了安全传输

[英]Check if secure transfer is enabled in azure storage account

We can set if secure tansfer is enabled or not when creating storage account in azure portal but is there a way to check if a storage account is enabled or not through api/sdk?在 azure 门户中创建存储帐户时,我们可以设置是否启用了安全传输,但是有没有办法通过 api/sdk 检查存储帐户是否启用?

You can get this information in multiple ways depending on your preference:您可以根据自己的喜好以多种方式获取此信息:

  • Azure CLI Azure CLI
  • Azure PowerShell Azure PowerShell
  • .Net Fluent SDK .Net Fluent SDK
  • Java SDK Java SDK
  • and other SDKs that exist和其他存在的 SDK

Here are the snippets reduced to only display the value of the field.以下是简化为仅显示字段值的片段。 Replace the placeholders <..> with their real values.将占位符 <..> 替换为它们的实际值。 The storage account will be identified by resource group name and storage account name.存储帐户将由资源组名称和存储帐户名称标识。 The solutions presume that you now how to authenticate.解决方案假定您现在如何进行身份验证。

Azure CLI Azure CLI

az storage account show --resource-group <ResourceGroupName> --name <StorageAccountName> --query enableHttpsTrafficOnly

Azure PowerShell Azure PowerShell

Get-AzStorageAccount -ResourceGroupName <ResourceGroupName> -Name <StorageAccountName> | Select-Object EnableHttpsTrafficOnly

Fluent SDK (C# console app) Fluent SDK(C# 控制台应用程序)

//requires references for Microsoft.Azure.Management.Fluent and Microsoft.Azure.Management.Storage.Fluent

IAzure myAzure = Azure.Authenticate("azure.auth").WithDefaultSubscription();    
Console.WriteLine(myAzure.StorageAccounts.GetByResourceGroup("<ResourceGroupName>", "<StorageAccountName>").Inner.EnableHttpsTrafficOnly);

Java SDK Java SDK

There is also an SDK for Java and it seems to work in an identical fashion. Java 还有一个 SDK ,它似乎以相同的方式工作。 Looking at the code, you should be able to achieve the same, as with the .NET SDK.查看代码,您应该能够实现与 .NET SDK 相同的效果。

Here is a link for storage account management samples with Java and the SDK: Java SDK Storage Account Management Go to the section List storage accounts and adapt the sample similar to my C# code (apply getByResourceGroup(...) and.Inner.enableHttpsTrafficOnly Here is a link for storage account management samples with Java and the SDK: Java SDK Storage Account Management Go to the section List storage accounts and adapt the sample similar to my C# code (apply getByResourceGroup(...) and.Inner.enableHttpsTrafficOnly

I hope this is of some help.我希望这会有所帮助。

Yes, it is possible to do so.是的,可以这样做。 If you're using Storage Resource Provider's Get Properties operation on a storage account, you will see a property called supportsHttpsTrafficOnly .如果您在存储帐户上使用存储资源提供程序的Get Properties操作,您将看到一个名为supportsHttpsTrafficOnly的属性。 True value indicates that secure transfer is enabled and false value indicates it otherwise.真值表示启用了安全传输,假值表示不启用。

I have not used Java SDK but a quick look at StorageAccount class indicates that this capability is exposed through enableHttpsTrafficOnly() property.我没有使用过 Java SDK 但快速查看StorageAccount class 表明此功能通过enableHttpsTrafficOnly()属性公开。 So it should be possible to get this information through SDK as well.所以应该也可以通过 SDK 获得这些信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure存储Java API:检查存储帐户是否支持安全传输或不使用Java SDK - Azure Storage Java API: Check if storage account support secure transfer or not using java SDK Azure存储帐户Blob容器大小 - Azure Storage Account Blobs container size 如何在 java 中编写 azure function 以将 Z466DEEC76ECDF24FCA6D38571F6 文件从帐户传输到 cocoa6DEEC76ECDF24FCA6D38571F6 文件? 我已经尝试过,但我收到了这个错误 - How to write an azure function in java to transfer json file from blob storage to cosmos db account? I have tried but I am getting this error 无法从 Azure 存储帐户中删除 blob - Azure Function (Java) - Not able to delete blob from Azure storage Account - Azure Function (Java) 有没有办法通过 Azure 存储中的帐户杠杆获取存储帐户层(热或冷)? - Is there a way to get the storage account tier(hot or cold) through the account lever in azure storage? 安全等级:启用密码锁 - Secure Class: Passlock enabled 通过代理服务器连接到Azure存储帐户的Microsoft Azure Java存储SDK - Connecting to Azure storage account thru proxy server Microsoft Azure Storage SDK for Java 仅使用 SAS 令牌连接到 Azure 存储帐户? - Connect to Azure Storage Account using only SAS token? mvn azure-functions:deploy 创建“无效的存储帐户名称” - mvn azure-functions:deploy creates 'not valid storage account name' 如何使用 Java 列出 Azure 存储帐户中的空容器? - How to list empty containers in Azure storage account using Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM