Created
February 28, 2020 23:38
-
-
Save lukemurraynz/b54356d34d7ad043ac5835c7156b8449 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Version 2.0 -Modules Az.Accounts, Az.Resources, CredentialManager | |
function New-AzureResourceGroup | |
{ | |
<# | |
.SYNOPSIS | |
Creates Azure Resource Group | |
.DESCRIPTION | |
Creates Azure Resource Group function, created as a test function for Universal Automation Desktop | |
.EXAMPLE | |
New-AzureResourceGroup | |
#> | |
param | |
([Parameter(Mandatory = $true, HelpMessage = 'Enter the name of the Resource Group you want to create', Position = 0)] | |
[ValidateNotNullorEmpty()] | |
[string] $Name, | |
[Parameter(Position = 1)] | |
[string] | |
$Location = 'Australia East' | |
) | |
$tenantId = (Get-StoredCredential -Target 'MSDN SPN Demo').GetNetworkCredential().UserName | |
$pscredential = (Get-StoredCredential -Target 'MSDN SPN Demo Key') | |
Connect-AzAccount -ServicePrincipal -Credential $pscredential -Tenant $tenantId | |
New-AzResourceGroup -Name $Name -Location $Location -Force | |
} | |
New-AzureResourceGroup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment