Posts

Showing posts with the label Azure

Create multiple Azure files shares using Powershell

If you have to create multiple shares for an Azure files instance as part of a migration or new deployment it can be very time consuming. With this script you put the name of the shares in a txt file called "shares.txt" and it will loop through and create them all and assign them to the hot tier. <# .SYNOPSIS Created by James Lambert www.roonics.com .DESCRIPTION This script creates shares from a txt file in Azure and set's their access tier .EXAMPLE .OUTPUTS .NOTES #> # CONFIG START $file = Get-Content -Path "shares.txt" $accessTier = "Hot" $tenant = "<tenant id>" $subscription = "<subscription id>" $resourceGroupName = "<resource group>" $storageAccountName = "<storage account name>" # CONFIG END # CONNECT TO AZURE Connect-AzAccount -Tenant $tenant -SubscriptionId $subscription # GET STORAGE KEY $storageKey = (Get-AzStorageAccountKey ` -ResourceGroupName $resour...

Apply tags to azure resource groups from csv file

This script is used to apply tags as per a csv file. Tags will be applied in uppercase. If a resource group is present in the csv but not in Azure it will be skipped. A log file will be generated in the log folder. A backup of the resource groups previous tags and values will be created in the backup folder. CSV should be formatted as the Example file and saved as tags.csv in c:\temp\tags unless you specify differently under the config section An example csv file can be downloaded here <# .SYNOPSIS Created by James Lambert www.roonics.com .DESCRIPTION This script is used to apply tags as per a csv file. Tags will be applied in uppercase. If a resource group is present in the csv but not in Azure it will be skipped. A log file will be generated in the log folder. A backup of the resource groups previous tags and values will be created in the backup folder. .EXAMPLE CSV should be formatted as below or see the example file and saved as tags.csv in c:\temp\tags unless you specify d...

List object contributors in all Azure subscriptions with Powershell

Image
The below script will loop through all Azure subscriptions excluding Visual Studio subscriptions, it will then look at every object and list/export everyone who has a role that has the word "Contributor" in it. Example below: <### .Synopsis Created by James Lambert www.roonics.com .DESCRIPTION This script will connect to Azure and cycle through all subscriptions listing all the objects and who has a role which has "Contributor" in the name .EXAMPLE Run the script and sign in to Azure .OUTPUTS A file csv file will be created for each subscription named "contribuators_subscription.csv" in c:\temp A total number of contributors will be added to the bottom of the csv .NOTES Keep in mind this will only be able to look at subscriptions you have permissions to. This will also skip the Visual studio subscription using a if the name like 'visual' statement ###> ### Config and clear screen cls $Path = "C:\Temp\" $f...

AZ-104 - Microsoft Azure Administrator Study Notes

  Manage Azure identities and governance RBAC Roles Contributor Full access to manage Azure resources Cannot assign roles in Azure RBAC Owner Full access to manage Azure resources Can assign roles to other users in Azure RBAC Reader Can view resources but cannot make changes User Access Administrator Can manage user access to Azure resources There is a limit of 2000 custom roles per tenant devtest labs user role only lets you connect, start, restart and shutdown virtual machines in azure devtest labs. You can assign custom roles to users, groups, and service principals at management group, subscription, and resource group scopes. Custom roles can be shared between subscriptions that trust the same Microsoft Entra tenant. There is a limit of 5,000 custom roles per tenant. (For Microsoft Azure operated by 21Vianet, the limit is 2,000 custom roles.) Custom roles can be created using the Azure portal, Azure PowerShell, Azure CLI, or the REST API. Azure Policy Used to ensure Azure resou...