Get-WebsiteLog - Name "MySite" -Tail
Learning Azure Computing
Different Powershell Commands
Tuesday, May 10, 2016
Deploying and Managing Azure Websites with Powershell Commands
Extract from : MSDN
| Name | Description |
|---|---|
| Get-AzureWebsite | Gets information about websites in Azure associated with the current subscription. |
| Get-AzureWebsiteDeployment | Gets the deployments for a website in Azure. |
| Get-AzureWebsiteLocation | Gets all available website locations. |
| New-AzureWebsite | Create a new website to run in Azure. |
| Remove-AzureWebsite | Removes the specified website from Azure. |
| Restart-AzureWebsite | Stops and then restarts the specified website. |
| Restore-AzureWebsiteDeployment | Redeploys a previous deployment of a website in Azure. |
| Save-AzureWebsiteLog | Downloads and saves the logs for a specified website. |
| Set-AzureWebsite | Configures a website running in Azure. |
| Show-AzurePortal | Show the Azure Management Portal. |
| Show-AzureWebsite | Opens a browser on a specified website. |
| Start-AzureWebsite | Starts the specified website. |
| Stop-AzureWebsite | Stops the specified website. |
Powershell commands for Deployment slots
1. Powershell commands to set 2 app settings "Sticky to a Slot":
SET-AzureWebsite -Name "mySite" -SlotStickyAppSettingsName @("mySlot", "mySlot2")
2. Powershell Command for Autoswap between Staging and Production Slot:
SET- AzureWebsite -Name "mySite" -SlotStaging - AutoSwapSlotName Production
3. Poweshell Command to set 2 connection strings as "Sticky to a Slot":
Set-AzureWebsite -Name "mySite" -SlotStickyConnectionStringName @("myConn","MyConn2")
SET-AzureWebsite -Name "mySite" -SlotStickyAppSettingsName @("mySlot", "mySlot2")
2. Powershell Command for Autoswap between Staging and Production Slot:
SET- AzureWebsite -Name "mySite" -SlotStaging - AutoSwapSlotName Production
3. Poweshell Command to set 2 connection strings as "Sticky to a Slot":
Set-AzureWebsite -Name "mySite" -SlotStickyConnectionStringName @("myConn","MyConn2")
Saturday, October 10, 2015
Moving a VM to a new Subnet using Powershell Commands
You can move a VM to a new subnet with the management portal or Windows PowerShell Commands
Get-AzureVM -ServiceName "<CloudServiceName>"
-Name "<VMName>"
Set-AzureSubnet -SubnetName "<SubnetName>"
Update-AzureVM
Get-AzureVM -ServiceName "<CloudServiceName>"
-Name "<VMName>"
Set-AzureSubnet -SubnetName "<SubnetName>"
Update-AzureVM
Wednesday, October 7, 2015
Creating an Online or Offline Secondary Database using PowerShell Commands
a. To create an online Secondary Database
Start-AzureDqlDatabaseCopy -ServerName "<Secondary Server Name>"
-DatabaseName "<Database Name>"
-PartnerServer "NewServer"
-ContinuousCopy
b. To create an Offline Secondary Database
Start-AzureDqlDatabaseCopy -ServerName "<Secondary Server Name>"
-DatabaseName "<Database Name>"
-PartnerServer "NewServer"
-ContinuousCopy
-OfflineSecondary
Access Storage Logs with PowerShell Commands
When Storage Logging is configured, log data is saved to blobs in the $logs container created for the storage account.
You can access logs with the Get-AzureStorageBlob command and filter logs by filename and metadata.
Get-AzureStorageBlob -Container '$logs' |
where {
$_.Name -match 'blob/YYYY/MM/DD/HHMM' -and
$_.ICloudBlob.Metadata.LogType -match 'write'
}
foreach {
"{0}{1}{2}{3}" -f $_.Name,
$_ICloudBlob.Metadata.StartTime,
$_ICloudBlob.Metadata.EndTime,
$_ICloudBlob.Metadata.LogType
}
You can access logs with the Get-AzureStorageBlob command and filter logs by filename and metadata.
Get-AzureStorageBlob -Container '$logs' |
where {
$_.Name -match 'blob/YYYY/MM/DD/HHMM' -and
$_.ICloudBlob.Metadata.LogType -match 'write'
}
foreach {
"{0}{1}{2}{3}" -f $_.Name,
$_ICloudBlob.Metadata.StartTime,
$_ICloudBlob.Metadata.EndTime,
$_ICloudBlob.Metadata.LogType
}
Configuring Storage Logging and Retention using PowerShell Commands
A. To enable Storage Logging for Read, Write and Delete Actions with Retention period of 30 days,
Set-AzureStorageServiceLoggingProperty
- ServiceType Blob
-LoggingOpertaions read,write,delete
-RetentionDays 30
Set-AzureStorageServiceLoggingProperty
- ServiceType Table
-LoggingOpertaions read,write,delete
-RetentionDays 30
Set-AzureStorageServiceLoggingProperty
- ServiceType Queue
-LoggingOpertaions read,write,delete
-RetentionDays 30
B. To disable collection of metrics
Set-AzureStorageServiceLoggingProperty
- ServiceType Blob
-LoggingOpertaions none
Set-AzureStorageServiceLoggingProperty
- ServiceType Table
-LoggingOpertaions none
Set-AzureStorageServiceLoggingProperty
- ServiceType Queue
-LoggingOpertaions none
Set-AzureStorageServiceLoggingProperty
- ServiceType Blob
-LoggingOpertaions read,write,delete
-RetentionDays 30
Set-AzureStorageServiceLoggingProperty
- ServiceType Table
-LoggingOpertaions read,write,delete
-RetentionDays 30
Set-AzureStorageServiceLoggingProperty
- ServiceType Queue
-LoggingOpertaions read,write,delete
-RetentionDays 30
B. To disable collection of metrics
Set-AzureStorageServiceLoggingProperty
- ServiceType Blob
-LoggingOpertaions none
Set-AzureStorageServiceLoggingProperty
- ServiceType Table
-LoggingOpertaions none
Set-AzureStorageServiceLoggingProperty
- ServiceType Queue
-LoggingOpertaions none
Subscribe to:
Comments (Atom)