- Learn Azure Administration
- Kamil Mrzyg?ód
- 337字
- 2021-06-11 18:14:33
Resources
Resources can follow a similar naming convention to resource groups. Let's verify the following samples:
<service>-<location>
<product>-<location>-<environment>-<service>
<company>-<location>-<environment>-<product>-<service>
Depending on your needs, you may require different data to be available. In general, you can implement the following two approaches:
- Each element has to be as verbose as possible.
- A child element only has to implement the extra information that is not available for the parent.
Here are examples of those two approaches:
TheCloudTheory-IT-Prod -> TheCloudTheory-SomeProduct-Use-Prod-Rg -> TheCloudTheory-SomeProduct-Use-Prod-AppServicePlan
TheCloudTheory-IT-Prod -> SomeProduct-Use-Prod-Rg -> AppServicePlan
The choice is yours – you have to select an approach that meets your requirements when it comes to administering resources in Azure.
Enforcing a naming convention without automating any action may be quite cumbersome. Fortunately, you can easily prepare a script that will tell you what resources do not match the rules. The following is a simple PowerShell script that displays all the resource groups that do not follow the <product>-<location>-<service> convention:
$resources = Get-AzureRmResource
foreach($resource in $resources)
{
$resourceName = $resource.Name
$match = $resourceName -match '[a-z]{1,}-[a-z]{1,3}-[a-z]{1,}'
if($match -eq $false)
{
Write-Host $resourceName
}
}
The preceding script iterates over all the resources inside a subscription and checks whether their names match the regular expression reflecting the expected naming convention. Now, let's say I have the following resource groups:
azure-administrator-logic
azureadministratorarm
azureadministratorarm2
azureadministratoreg
azurequeues
azureadministrator-euw-logicapp
limitsandquotas
uytgu2hddgsxistandardsa
The only one that follows the convention is azureadministrator-euw-logicapp – the rest are invalid and will be displayed.
Once you have your script ready, you can execute it any time you want. What's more is that you do not have to use PowerShell – you can leverage the Azure CLI or the REST API of the Azure Resource Manager to implement this functionality using other programming languages. Now that we've covered Azure Logic Apps, you can even implement your own pipeline integrated with Azure Event Grid, which will allow you to verify each resource once it has been provisioned.
For more information about naming conventions, refer to the following link: https://docs.microsoft.com/en-us/azure/architecture/best-practices/naming-conventions.
- 中國國民經(jīng)濟核算體系修訂問題研究
- 審計學基礎
- 審計學
- Azure Strategy and Implementation Guide
- 財務審計實務指南
- 財務建模與綜合估值:數(shù)據(jù)研磨、模型校準、動態(tài)估值
- Team Foundation Server 2013 Customization
- IBM SPSS Modeler Cookbook
- 高級計量經(jīng)濟分析及Stata應用
- Getting Started with Microsoft Lync Server 2013
- Big Data Analytics with R and Hadoop
- 統(tǒng)計學理論前沿(谷臻小簡·AI導讀版)
- Microsoft SharePoint 2010 Developer’s Compendium:The Best of Packt for Extending SharePoint
- 統(tǒng)計原理與實務
- Force.com Tips and Tricks