This script can view the fixed situation of the public IP of the cloud service in Classic mode, so that the administrator could view and fix the VIP of the cloud service that need to be fixed but not fixed in time.
The code is as follows:
$cred = get-credential-message "Use your Azure account to login"; [void]
(Add-azureaccount-environment azurechinacloud-credential $cred);
$subscriptions = get-azuresubscription; foreach ($subscription in $subscriptions) {$subscriptionName = $subscription.
Subscriptionname; [void] (Select-azuresubscription-subscriptionid $subscription.
SubscriptionId);
Write-host "==============" $subscriptionName "=============="; $serviceNames = Get-azureservice-erroraction Ignore |
Select ServiceName; $reservedServices = Get-azurereservedip-erroraction Ignore | Where-object {$_.
Servicename-ne $null};
foreach ($serviceNameObj in $serviceNames) {$flag = $true; foreach ($reservedServiceObj in $reservedServices) {if ($serviceNameObj. Servicename-eq $reservedServic Eobj.servicename) {write-host "[Reserved] Cloud Service Name:" $SERVICENAMEOBJ. ServiceName "R eserved IP Name: "$RESERVEDSERVICEOBJ. Reservedipname-Foregroundcolor Green;
$flag = $false;
Break }} if ($flag) {write-host "[unreserved] Cloud Service Name:" $SERVICENAMEOBJ. Servicen
Ame-foregroundcolor Red; }
}
}
Examples of output results: