This is an old revision of the document!


PowerShell

Services

Get-Service -Name *
Get-Service -Name puppet
Start-Service -Name puppet

Commands

$PSVersionTable.PSVersion                                                                                 #get version
Get-Module -Name PowerShellGet -ListAvailable | Select-Object -Property Name,Version,Path                 #
Import-Module PowerShellGet -Force                                                                        #Update Powershell version
Get-ExecutionPolicy                                                                                       #check policy
Set-ExecutionPolicy Unrestricted                                                                          #set policy to unrestricted
Install-Module -Name AZureRM -AllowClobber                                                                #install azure module
Import-Module -Name AzureRM                                                                               #import azure module - "Get-ExecutionPolicy" has to be set to unrestricted!
Login-AzureRmAccount                                                                                      #login
Get-AzureRmSubscription                                                                                   #check active login
New-AzureRMRecourceGroup -Name groupname -Location westeurope                                             #creates new resourcegroup

Create Storageaccount:

Login-AzureRmAccount

Get-AzureRmSubscription

cd\
cls

$location = "westeurope"
$group = "test-vm-rg"

$account = New-AzureRmStorageAccount -ResourceGroupName $group -Name tw012018 -Location $location -SkuName Standard_LRS

Get-AzureRMStorageAccount | Select StorageAccountName, Location

Azure CLI

https://docs.microsoft.com/de-de/cli/azure/install-azure-cli?view=azure-cli-latest

Powershell install:

Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'
az login --use-device-code                                                                                #generate url + machine-code
az login
az group list --out table                                                                                 #show resource groups

Create resource groups:

#Azure CLI

az login

$group = "test-vm-rg"
$location = "westeurope"
$account = "tw012018"

az storage account create --resource-group-name $group --location $location --sku Standard_LRS --name $account

az storage account show --resource-group $group --name $account
windows/powershell.1589273522.txt.gz · Last modified: 2020/05/12 10:52 by tmade
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki