当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

作者:精品下载站 日期:2024-12-14 10:00:27 浏览:13 分类:玩电脑

使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳


在这篇文章中,我将向您展示如何使用 PowerShell 列出所有 Azure 区域。您还可以使用 Azure Cloud Shell 获取所有 Azure 区域的列表以及物理位置和地理组详细信息。

每个 Azure 地理位置都包含一个或多个区域,并满足特定的数据驻留和合规性要求。从 Azure 门户中,很难列出所有 Azure 区域,而这正是 PowerShell 的用处。

Azure 中的大部分配置都可以通过 Azure 门户完成。但是,在某些情况下,使用 PowerShell 命令可以使您的任务更轻松。值得庆幸的是,PowerShell 自动化是通过 Azure 门户支持的。

要使用 PowerShell 管理 Azure,您必须首先安装 Azure PowerShell 模块。安装 Azure PowerShell 模块有多种方法。您可以选择下面列出的任何方法:

  1. 来自 WebPI 的 Azure PowerShell。下载 Azure PowerShell 并开始安装。
  2. 使用 PowerShell 库
  3. 从 GitHub 下载 MSI 安装程序

Get-AzLocation PowerShell Cmdlet

Get-AzLocation cmdlet 获取所有位置以及每个位置支持的资源提供程序。运行 Get-AzLocation 命令时,您将获得包含以下信息的输出。

  • 供应商
  • 地点
  • 显示名称
  • 类型
  • 经度
  • 纬度
  • 物理位置
  • 区域类型
  • 地区类别
  • 地理组
  • 配对区域

Get-AzLocation cmdlet 支持以下参数:

  • -预
  • -扩展位置
  • -默认配置文件
  • -Api版本

使用 PowerShell 列出所有 Azure 区域

让我们看看使用 PowerShell 列出所有 Azure 区域的步骤。假设你已安装适用于 PowerShell 的 Azure 模块,请在计算机上启动 PowerShell 并运行以下命令。

Login-AzAccount

输入上述命令后,将出现 Microsoft Azure 登录窗口,要求您输入凭据才能登录 Azure。

您还可以使用 Connect-AzAccount cmdlet,它通过经过身份验证的帐户连接到 Azure,以便与 Az PowerShell 模块中的 cmdlet 结合使用。

输入电子邮件和密码以连接到 Azure 并登录 Azure 帐户。

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

在 PowerShell 窗口中运行以下命令以获取所有 Azure 区域。

Get-AzLocation | select displayname,location

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

使用 Cloud Shell 列出所有 Azure 区域

通过连接到 Azure Cloud Shell,您可以运行简单的 PowerShell 命令来列出所有 Azure 区域。从 Azure 门户连接到 Cloud Shell

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

等待云shell连接成功。

Requesting a Cloud Shell.Succeeded. 
Connecting terminal...
MOTD: Customize your experience: save your profile to $HOME/.config/PowerShell
VERBOSE: Authenticating to Azure ...
VERBOSE: Building your Azure drive ...

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

在 Cloud Shell 中运行以下命令以获取所有 Azure 区域。

Get-AzLocation | select displayname,location

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

命令输出现在显示所有 Azure 区域的 DisplayName位置

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

获取特定区域中的所有 Azure 服务

当您想要查看特定区域中的所有服务时,以下命令非常有用。

$providers = Get-AzLocation | Where-Object {$_.Location -eq "eastus2"} | select Providers
$providers.Providers

[玩转系统] 使用 PowerShell 列出所有 Azure 区域 | Azure 云外壳

Microsoft.DevTestLab
Microsoft.AAD
Microsoft.OperationalInsights
Microsoft.Security
Microsoft.Network
Microsoft.Compute
Microsoft.Storage
Microsoft.ClassicCompute
Microsoft.OperationsManagement
Microsoft.ManagedIdentity
microsoft.aadiam
Microsoft.AnalysisServices
Microsoft.ApiManagement
Microsoft.App
Microsoft.AppConfiguration
Microsoft.AppPlatform
Microsoft.Attestation
Microsoft.Automanage
Microsoft.Automation
Microsoft.AVS
Microsoft.AzureArcData
Microsoft.AzureCIS
Microsoft.AzureData
Microsoft.AzureSphere
Microsoft.AzureSphereGen2
Microsoft.AzureStackHCI
Microsoft.BackupSolutions
Microsoft.BareMetalInfrastructure
Microsoft.Batch
Microsoft.Cache
Microsoft.Cdn
Microsoft.Chaos
Microsoft.ClassicInfrastructureMigrate
Microsoft.ClassicNetwork
Microsoft.ClassicStorage
Microsoft.CloudTest
Microsoft.CognitiveServices
Microsoft.Confluent
Microsoft.ContainerInstance
Microsoft.ContainerRegistry
Microsoft.ContainerService
Microsoft.D365CustomerInsights
Microsoft.Dashboard
Microsoft.Databricks
Microsoft.DataCollaboration
Microsoft.DataFactory
Microsoft.DataLakeAnalytics
Microsoft.DataLakeStore
Microsoft.DataMigration
Microsoft.DataProtection
Microsoft.DataShare
Microsoft.DBforMariaDB
Microsoft.DBforMySQL
Microsoft.DBforPostgreSQL
Microsoft.DelegatedNetwork
Microsoft.DeploymentManager
Microsoft.DesktopVirtualization
Microsoft.Devices
Microsoft.DeviceUpdate
Microsoft.DevOps
Microsoft.DigitalTwins
Microsoft.DocumentDB
Microsoft.Elastic
Microsoft.EventGrid
Microsoft.EventHub
Microsoft.ExtendedLocation
Microsoft.Fidalgo
Microsoft.HanaOnAzure
Microsoft.HardwareSecurityModules
Microsoft.HDInsight
Microsoft.HealthBot
Microsoft.HealthcareApis
Microsoft.HybridCompute
Microsoft.HybridConnectivity
Microsoft.ImportExport
microsoft.insights
Microsoft.IoTCentral
Microsoft.IoTSecurity
Microsoft.KeyVault
Microsoft.Kubernetes
Microsoft.KubernetesConfiguration
Microsoft.Kusto
Microsoft.LabServices
Microsoft.LoadTestService
Microsoft.Logic
Microsoft.MachineLearning
Microsoft.MachineLearningServices
Microsoft.Maintenance
Microsoft.Maps
Microsoft.Media
Microsoft.Migrate
Microsoft.MixedReality
Microsoft.Monitor
Microsoft.NetApp
Microsoft.NetworkFunction
Microsoft.NotificationHubs
Microsoft.OpenLogisticsPlatform
Microsoft.Peering
Microsoft.PlayFab
Microsoft.Portal
Microsoft.PowerBI
Microsoft.PowerBIDedicated
Microsoft.Purview
Microsoft.RecoveryServices
Microsoft.RedHatOpenShift
Microsoft.Relay
Microsoft.Resources
Microsoft.Search
Microsoft.SecurityDetonation
Microsoft.SerialConsole
Microsoft.ServiceBus
Microsoft.ServiceFabric
Microsoft.ServiceFabricMesh
Microsoft.ServiceLinker
Microsoft.ServicesHub
Microsoft.SignalRService
Microsoft.Singularity
Microsoft.Solutions
Microsoft.Sql
Microsoft.SqlVirtualMachine
Microsoft.StorageCache
Microsoft.StoragePool
Microsoft.StorageSync
Microsoft.StreamAnalytics
microsoft.support
Microsoft.Synapse
Microsoft.TimeSeriesInsights
Microsoft.VideoIndexer
Microsoft.VirtualMachineImages
microsoft.visualstudio
Microsoft.Web
Microsoft.Workloads
NGINX.NGINXPLUS
Wandisco.Fusion

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯