Last active
December 2, 2021 06:22
-
-
Save hochun836/767511002cb549a2f185555d9a471c50 to your computer and use it in GitHub Desktop.
This file contains 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
# intro. | |
AzureRM (Azure Resource Manager) | |
Az (new module, recommended) | |
after the verb will have 'Az' prefix | |
# base | |
Connect-AzAccount | |
Get-AzContext | |
# resource group | |
Get-AzResourceGroup | |
Get-AzResourceGroup | Format-List | |
Get-AzResourceGroup | Format-Table | |
Get-AzResourceGroup | Format-Wide | |
Get-AzResourceGroup | Export-Csv -Path <path.csv> | |
Get-AzResourceGroup | Out-GridView | |
Get-AzResourceGroup | Out-GridView -PassThru // with the Passthru parameter, powershell returns the output in the console | |
Get-AzResourceGroup | Select ResourceGroupName, Location | |
Get-AzResourceGroup | Where-Object { $_.ResourceGroupName -eq 'RG1102' } | |
Get-AzResourceGroup | Where-Object { $_.ResourceGroupName -eq 'RG1102' } | Select ResourceGroupName, Location | |
Get-AzResourceGroup | ` | |
>> Where-Object { $_.ResourceGroupName -eq 'RG1102' } | ` | |
>> Select ResourceGroupName, Location | |
# synapse | |
Get-AzSynapseSqlPool -WorkspaceName <workspace-name> // get all sql pools under a workspace | |
Get-AzSynapseSqlPool -WorkspaceName asa1102 | |
Get-AzSynapseSqlPool -WorkspaceName <workspace-name> -Name <sql-pool-name> // get the sql pool under the workspace | |
Get-AzSynapseSqlPool -WorkspaceName asa1102 -Name DSP | |
Resume-AzSynapseSqlPool -WorkspaceName <workspace-name> -Name <sql-pool-name> | |
Resume-AzSynapseSqlPool -WorkspaceName asa1102 -Name DSP | |
Suspend-AzSynapseSqlPool -WorkspaceName <workspace-name> -Name <sql-pool-name> | |
Suspend-AzSynapseSqlPool -WorkspaceName asa1102 -Name DSP | |
=> ref: https://docs.microsoft.com/en-us/powershell/module/az.synapse | |
Q: Get-InstalledModule doesn't show Az.Synapse ? | |
'While the Az.Synapse PowerShell module is in preview, you must install it separately using the Install-Module cmdlet.' | |
Install-Module -Name Az.Synapse | |
=> ref: https://docs.microsoft.com/zh-tw/azure/synapse-analytics/quickstart-create-workspace-powershell#install-the-azure-synapse-powershell-module | |
# [note] install Az Module | |
'PowerShell 7.0.6 LTS, PowerShell 7.1.3, or higher is the recommended version of PowerShell for use with the Azure Az PowerShell module on all platforms.' | |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force | |
=> ref: https://docs.microsoft.com/zh-tw/powershell/azure/install-az-ps | |
# [note] compatibility AzureRM | |
Enable-AzureRmAlias | |
# [note] learn | |
=> ref: https://www.youtube.com/watch?v=LbGNQVbb_VI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment