简体   繁体   English

如何从多个资源组中导出LocalNetworkGateway信息

[英]How to export LocalNetworkGateway info from multiple Resource Groups

I'm new to powershell and azure and need to export all the LocalNetworkGateway information from multiple Subscriptions and Resource Groups . 我是Powershell和Azure的新手,需要从多个订阅资源组中导出所有LocalNetworkGateway信息。

I have a script to export from Resource Groups but I have to manually enter the ResourceGroupName for each one. 我有一个脚本可以从资源组中导出,但是我必须手动输入每个脚本的ResourceGroupName

Is there a way to have a variable that contains all the ResourceGroupNames so that I don't have to run the script 40 times and manually enter a different ResourceGroupName for each? 有没有一种方法可以包含一个包含所有ResourceGroupName的变量,这样我就不必运行脚本40次并为每个脚本手动输入一个不同的ResourceGroupName

Any help would be gratefully received. 任何帮助将不胜感激。

I have code for one Resource Group at a time. 我一次有一个资源组的代码。

Get-AzLocalNetworkGateway -ResourceGroupName “RGName” | Export-Csv -Path "c:\Azure\LocalNetworkGateway.csv"

you can just iterate over resource groups: 您可以遍历资源组:

$resourceGroups = Get-AzResourceGroup
$resourceGroups.foreach{ 
     Get-AzLocalNetworkGateway -ResourceGroupName $_.ResourceGroupName | 
         Export-Csv -Path "c:\Azure\LocalNetworkGateway.csv" -Append
} 

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

相关问题 如何从多个ResourceGroup以及多个订阅中导出LocalNetworkGateway信息 - How to export LocalNetworkGateway info from multiple ResourceGroups but also across multiple subscriptions 如何导出多个 Azure DevOps 变量组? - How to export multiple Azure DevOps Variable Groups? Azure 多个资源组中的 ExpressRoute? - ExpressRoute in Azure Multiple Resource Groups? 将带有标签的 Azure 资源组导出到 csv - Export Azure Resource Groups with Tags to csv 在多个资源组中添加相同的资源 - Adding same resource in multiple resource groups 多个订阅时按资源组计算 VM - Count VMs by resource groups when multiple subscriptions 如何使用 for_each 或 count for azure 为多个名称创建具有存储帐户的多个资源组? - How to create multiple resource groups with storage accounts for multiple names using for_each or count for azure? 如何从 azure rest API 获取资源和资源组成本信息 - how to get Resource and Resource groups Cost information, from azure rest API'S 如何恢复已删除的 Azure 资源组 - How to restore deleted azure resource groups 如何通过策略将 Azure 资源锁应用于资源组 - How to apply Azure resource locks to Resource Groups via Policy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM