How to use Azure PowerShell for Managed Cache
First, learn how to install and download Azure PowerShell at http://azure.microsoft.com/en-us/documentation/articles/install-configure-powershell/.
Discover the cmdlets
PS C:\> help azuremanagedcache
Name Category Module Synopsis
---- -------- ------ --------
Get-AzureManagedCache Cmdlet Azure Gets the Azure Caches in your Azure account.
Get-AzureManagedCacheAccessKey Cmdlet Azure Gets the access keys for an Azure Cache
New-AzureManagedCache Cmdlet Azure Creates an Azure cache
New-AzureManagedCacheAccessKey Cmdlet Azure Creates new access keys for an Azure Cache.
Remove-AzureManagedCache Cmdlet Azure Deletes an Azure Cache
Set-AzureManagedCache Cmdlet Azure Changes the properties of an Azure Cache.
Create a new managed cache
You can use New-AzureManagedCache
cmdlet to create a managed cache.
You need to specify:
- Name of the managed cache via
Name
parameter. - Location of the managed cache via
Location
parameter.
You can also specify:
- Sku of the managed cache. You can use Basic, Standard or Premium. By default, it's Basic.
- Memory of the managed cache. Valid values vary based on the sku you select.
One thing really cool is that these 2 parameters have tab-completion of their validate values so that you can find out what value you can use easily.
The following example shows how to create a managed cache of sku "Standard" and memory size 1GB.
New-AzureManagedCache -Name test -Location "West US" -Sku Standard -Memory 1GB
# For full help content, run help New-AzureManagedCache -Full
Update an existing managed cache
You can use Set-AzureManagedCache
cmdlet to update an existing managed cache. You can change the sku and memory.
The following example shows how to change the memory size of an existing managed cache of to 2GB.
Set-AzureManagedCache -Name test -Memory 2GB
# For full help content, run help Set-AzureManagedCache -Full
Get existing managed cache
You can use Get-AzureManagedCache
cmdlet to get existing managed cache:
- If
Name
parameter is given, return the managed cache with the given name. - If
Name
parameter is not give, return all the managed cache in the subscription.
The following example shows how to get an existing managed cache by its name.
Get-AzureManagedCache -Name test
# For full help content, run help Get-AzureManagedCache -Full
Remove an existing managed cache
You can use Remove-AzureManagedCache
cmdlet to remvoe an existing managed cache. This cmdlet will prompt for confirmation. If you are doing this in automation scenario, use the Force
parameter to bypass the prompt.
The following example shows how to remove an existing managed cache.
Remove-AzureManagedCache -Name test
# For full help content, run help Remove-AzureManagedCache -Full
Get managed cache access key
You can use Get-AzureManagedCacheAccessKey
cmdlet to get the primary and secondary access keys of an existing managed cache.
The following example shows how to get the primary and secondary access keys of an existing managed cache.
Get-AzureManagedCacheAccessKey -Name test
# For full help content, run help Get-AzureManagedCacheAccessKey -Full
Regenerate managed cache access key
You can use New-AzureManagedCacheAccessKey
cmdlet to regenerate the primary or secondary access key of an existing managed cache. You can use the KeyType
parameter to specify which access key to regenerate. By default, it will regenerate the primary access key.
The following example shows how to regenerate the secondary access key of an existing managed cache.
New-AzureManagedCacheAccessKey -Name test -KeyType Secondary
# For full help content, run help New-AzureManagedCacheAccessKey -Full