在很多情況下,當(dāng)我們使用完Azure資源組之后總是忘記刪除它們,所以我創(chuàng)建了下面的PowerShell腳本來幫助清理它們。它適用于所有的賬戶訂閱。如果您的賬戶中有很多人在管理不同的Azure Resource但其并而不是自己清理空的資源組,那么這個腳本就很有用
創(chuàng)新互聯(lián)專注于博州網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供博州營銷型網(wǎng)站建設(shè),博州網(wǎng)站制作、博州網(wǎng)頁設(shè)計、博州網(wǎng)站官網(wǎng)定制、重慶小程序開發(fā)服務(wù),打造博州網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供博州網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
#Log in to Azure account Login-AzureRmAccount #Global Login-AzureRmAccount -Environment AzureChinaCloud #21V #Get list of Azure Subscription ID's $Subs = (get-AzureRMSubscription).ID #Loop through the subscriptions to find all empty Resource Groups and store them in $EmptyRGs ForEach ($sub in $Subs) { Select-AzureRmSubscription -SubscriptionId $Sub $AllRGs = (Get-AzureRmResourceGroup).ResourceGroupName $UsedRGs = (Get-AzureRMResource | Group-Object ResourceGroupName).Name $EmptyRGs = $AllRGs | Where-Object {$_ -notin $UsedRGs} #Loop through the empty Resorce Groups asking if you would like to delete them. And then deletes them. foreach ($EmptyRG in $EmptyRGs){ $Confirmation = Read-Host "Would you like to delete $EmptyRG '(Y)es' or '(N)o'" IF ($Confirmation -eq "y" -or $Confirmation -eq "Yes"){ Write-Host "Deleting" $EmptyRG "Resource Group" Remove-AzureRmResourceGroup -Name $EmptyRG -Force } } }
網(wǎng)站名稱:使用PowerShell查找和刪除所有Azure訂閱中的空資源組
當(dāng)前鏈接:http://aaarwkj.com/article38/jeejpp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、網(wǎng)站內(nèi)鏈、面包屑導(dǎo)航、響應(yīng)式網(wǎng)站、服務(wù)器托管、搜索引擎優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)