-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAIDDCincyRGCreateToShare.ps1
29 lines (23 loc) · 1.04 KB
/
AIDDCincyRGCreateToShare.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$startTime = Get-Date
$subscriptionID = '<ENTER SUBSCRIPTION ID HERE>'
$resourceGroupName = "AIDDCincy"
$resourceGroupLocation = "East US2"
Write-Host "The resource group creation script was started " $startTime
Login-AzureRmAccount
Select-AzureRmSubscription -Subscriptionid $subscriptionID
#Create or check for existing resource group
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue
if(!$resourceGroup)
{
Write-Host "Resource group '$resourceGroupName' does not exist. To create a new resource group, please enter a location.";
if(!$resourceGroupLocation) {
$resourceGroupLocation = Read-Host "resourceGroupLocation";
}
Write-Host "Creating resource group '$resourceGroupName' in location '$resourceGroupLocation'";
New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation
}
else{
Write-Host "Using existing resource group '$resourceGroupName'";
}
$endTime = Get-Date
write-host "Ended resource group creation at " $endTime