Benutzer:MovGP0/Azure/Infrastructure Services

   MovGP0        Über mich        Hilfen        Artikel        Weblinks        Literatur        Zitate        Notizen        Programmierung        MSCert        Physik      


Azure Infrastructure Services

Bearbeiten
Installation des Azure Moduls
#As Admin
Install-Module Azure -Force -AllowClobber
Install-Module AzureRM -Force -AllowClobber
# when installation fails, 
## go to 'cd $env:ProgramFiles\WindowsPowerShell\Modules' and delete Azure* directories
## update PSGet using 'Install-Module PowerShellGet'

# As User
Import-Module AzureRM
Get-Command -Module AzureRM

Authenticate to Azure with a certificate

Bearbeiten
Get-AzurePublishSettingsFile
# log in to Azure
# download the '.publishsettings' file

# Import the '.publishsettings' file
Import-PublishSettingsFile 'C:\Scripts\.publishsettings'

Authenticate to Azure via Active Directory

Bearbeiten
Add-AzureAccount -Credential (Get-Credential)
Remove-AzureAccount

Manage Aure Subscriptions

Bearbeiten
Get-AzureSubscription 
Get-AzureSubscription -Default # subscription that is used for new PS Sessions
Get-AzureSubscription -Current # currently set subscription 
Get-AzureSubscription -SubscriptionName "" -ExtendedDetails

Select-AzureSubscription # switches to another Azure Subscription 
Select-AzureSubscription -SubscriptionName "" -Default # sets the default subscription
Select-AzureSubscription -NoDefault # deletes the default
Select-AzureSubscription -SubscriptionName "" -Current # sets the current subscription
Select-AzureSubscription -NoCurrent # disconnects the subscription from the current PS Session

Subsriptions are managed in "$env:AppData\Windows Azure PowerShell".

$cert = Get-Item Cert:\CurrentUser\My\[certificate thumbprint] 
$subscriptionID = "[SubscriptionID]" 
$localName = "[Subscription Name]" 
Set-AzureSubscription -SubscriptionName $localName -SubscriptionId $subscriptionID -Certificate $ cert

|}