Validating digital networks guidelines in a Storage Account utilizing PowerShell

When managing entry in a Storage Account in Microsoft Azure, the Azure Portal has a administration interface that enables the cloud administrator so as to add and take away digital networks simply.

virtual networks rules

However when scripting to validate to make sure consistency, PowerShell is the device for the job. The cmdlet to retrieve the checklist of digital community guidelines in a Storage Account is Get-AzStorageAccountNetworkRuleSet. Nonetheless, it is strongly recommended to retailer the output of the cmdlet in a variable. On this instance, we’re utilizing $tmpSTGRules.

We are able to checklist all the content material, together with motion, VirtualnetworkResourceId, and State utilizing $tmpSTGRules.VirtualNetworkRules, as depicted within the picture beneath.

virtual networks rules

If we wish to verify if a selected subnet is configured inside the existent Digital Community Guidelines, we will use the next cmdlets and supply the useful resource id of the subnet. The output might be True whether it is there or False in case the entry doesn’t exist.

$tmpStgRules.VirtualNetworkRules.VirtualNetworkResourceId.Incorporates("/subscriptions/<subscriptionID>/resourceGroups/<ResourceGroupName>/providers/Microsoft.Network/virtualNetworks/<VirtualNetworkName>/subnets/<SubnetName>")

The put up Validating virtual networks rules in a Storage Account using PowerShell appeared first on TechGenix.

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *