azure - 使用 Get-AzLocation 选择特定的 Azure 位置
问题描述
我正在尝试找到一种使用 Azure PowerShell 选择目标 Azure 位置(对象)的方法。
这给了我位置列表:
Get-AzLocation | select DisplayName, Location | Format-Table
如何选择其中 1 个,例如...
$Location = Get-AzLocation -Something "South Central US"
解决方案
您可以Where-Object
用来过滤DisplayName
:
❯ Get-AzLocation | Where-Object {$_.DisplayName -eq "South Central US"}
Location : southcentralus
DisplayName : South Central US
Providers : {Microsoft.Automation, Microsoft.Storage, Microsoft.Network, Microsoft.Compute…}
这将返回一个类型的对象Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResourceProviderLocation
。
推荐阅读
- python - 如何在另一个类中使用模块的方法
- active-directory - 获取特定生日的所有用户
- unit-testing - 在 Vue Test Utils 中模拟退格
- ruby - 有没有办法同时(并行)运行三个循环 ruby 方法?
- exception-handling - 处理层之间的异常
- r - 在 R 中复制 SAS 阵列
- continuous-integration - 持续交付本地可安装产品,支持跨不同客户安装的多个版本
- r - 将值格式更改为 R 中的标准 30 秒格式
- apache-spark - Spark 广播失败
- javascript - 使用 REST api 进行 JIRA 的 REACTjs 基本身份验证