Benutzer:MovGP0/Azure/Infrastructure Services

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
   MovGP0        Über mich        Hilfen        Artikel        Weblinks        Literatur        Zitate        Notizen        Programmierung        MSCert        Physik      


Azure Infrastructure Services

[Bearbeiten | Quelltext 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 | Quelltext 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 | Quelltext bearbeiten]
Add-AzureAccount -Credential (Get-Credential)
Remove-AzureAccount

Manage Aure Subscriptions

[Bearbeiten | Quelltext 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

|}