Azure Tags

David Segura

This page is incomplete

You're probably wondering why Tags are used by OSDCloud, and why it won't work without them. The way OSDCloud works in Azure is that it needs to locate the WIM files that are in a Container that are within a Storage Account

Get-AzStorageAccount (Az.Storage)

This PowerShell cmdlet is used to get all the Storage Accounts that you can see in your Azure Subscription with the (Storage Account) Reader role. In my case, I have 13 Storage Accounts

PS C:\> Get-AzStorageAccount | Select StorageAccountName

StorageAccountName 
------------------ 
azosd              
azosdcloud         
azosdweb           
cdsosd             
cs710032001c802b70f
getosdcloudcom     
goosdcloudcom      
mmsmoa             
mmsmoafunction     
osdcloudazure      
osdclouddemo       
ou812              
winpe     

Ideally, you should assign Rights to limit what I can read from, but as an Azure Global Admin, I get to see everything. Additionally, not all of these Storage Accounts are used for OSD. Some are used by Functions, or Reporting, etc.

Get-AzTag (Az.Resources)

You can see all the Tags (Key) in your Azure Subscription using this cmdlet. In the example below, I have two Azure Resources that have an OSDCloud Tag

PS C:\> Get-AzTag

Name              Count
----              -----
ms-resource-usage 1    
OSDCloud          2 

Tags Property

PowerShell makes it easy to see which Storage Accounts are used by OSDCloud

PS C:\> Get-AzStorageAccount | Select-Object StorageAccountName, Tags
StorageAccountName  Tags                                    
------------------  ----                                    
azosd               {}                                      
azosdcloud          {[OSDCloud, Production]}                
azosdweb            {}                                      
cdsosd              {}                                      
cs710032001c802b70f {[ms-resource-usage, azure-cloud-shell]}
getosdcloudcom      {}                                      
goosdcloudcom       {}                                      
mmsmoa              {}                                      
mmsmoafunction      {}                                      
osdcloudazure       {}                                      
osdclouddemo        {[OSDCloud, Development]}               
ou812               {}                                      
winpe               {}  

PS C:\> Get-AzStorageAccount | Where-Object {$_.Tags.ContainsKey('OSDCloud')} | Select-Object ResourceGroupName,StorageAccountName,PrimaryLocation,SkuName,Tags
ResourceGroupName  : AzOSDCloud
StorageAccountName : azosdcloud
PrimaryLocation    : southcentralus
SkuName            : 
Tags               : {[OSDCloud, Production]}

ResourceGroupName  : OSDCloudDemo
StorageAccountName : osdclouddemo
PrimaryLocation    : southcentralus
SkuName            : 
Tags               : {[OSDCloud, Development]}

Last updated