123
Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Azure -Adding Data Disks - PowerShell

Azure - Adding Data Disks - PowerShell  PowerShell command for adding a data disk $resourcegroup = 'azuredemo' $machinename = 'demovm' $location = 'Central US' $storageType = 'Premium_LRS' $dataDiskName = 'newdisk01' $dataDiskSize = 10 $datadiskConfig = New-AzDiskConfig -SkuName $storageType -Location $location -CreateOption Empty -DiskSizeGB $dataDiskSize $dataDisk01 = New-AzDisk -DiskName $dataDiskName -Disk $datadiskConfig -ResourceGroupName $resourcegroup $vm = Get-AzVM -Name $machinename -ResourceGroupName $resourcegroup $vm = Add-AzVMDataDisk -VM $vm -Name $dataDiskName -CreateOption Attach -ManagedDiskId $dataDisk01.Id -Lun 1 Update-AzVM -VM $vm -ResourceGroupName $resourcegroup ...

Create Azure virtual machines - CLI and PowerShell

Create Azure virtual machines - CLI and PowerShell  Azure CLI for quickly creating a virtual machine az vm create --resource-group azuredemo --name demovm --image win2016datacenter --admin-username demousr --admin-password AzurePortal@123 PowerShell command for quickly creating a virtual machine New-AzVm -ResourceGroupName azuredemo -Name backupvm -Location CentralUS -Image win2016datacenter -Credential (Get-Credential) ...

Install Azure CLI via PowerShell

Install Azure CLI via PowerShell You can also install the Azure CLI using PowerShell. Start PowerShell as administrator and run the following command: Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi This will download and install the latest version of the Azure CLI for Windows. If you already have a version installed, the installer will update the existing version. After the installation is complete, you will need to reopen PowerShell to use the Azure CLI. Run the Azure CLI You can now run the Azure CLI with the az command from either Windows Command Prompt or PowerShell.  az login If the CLI can open your default browser, it will...

Connect MS AZURE to Powershell

Connect MS AZURE  to Powershell // Allow remote signed scripts to run Set-ExecutionPolicy RemoteSigned //Installing the Azure PowerShell modules Install-Module -Name Az -AllowClobber -Scope CurrentUser // Import all the Azure modules Import-Module Az -Verbose // Connect to your Azure account Connect-AzAccount // Get all resource groups running in a particular region Get-AzResourceGroup -Location central...