PowershellでSMTP認証メール送信
$Credentials = Get-Credential Send-MailMessage -To to@xxx.com -Subject test -From from@xxx.com -SmtpServer smtp.sendgrid.net -Port 587 -Credential $Credentials
AppServiceのメトリック取得
$ret=Get-AzMetric -ResourceId "/subscriptions/xxxxxxxxxxxxxxx/resourceGroups/JS002/providers/Microsoft.Web/sites/xxxxxxx" -MetricName "Requests" -TimeGrain 00:01:00 -StartTime 2020-04-29T15:00:00Z -EndTime 2020-04-29T15:10:00Z
$ret.data
VMメトリック取得
$resourceid="/subscriptions/xxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxx/providers/Microsoft.Compute/virtualMachines/xxxxxxxxx" $ret1=Get-AzMetric -ResourceId $resourceid -TimeGrain 01:0:00 -MetricName "Percentage CPU" -StartTime 2019-07-08T12:00:00Z -EndTime 2019-07-28T12:00:00Z -AggregationType Maximum -DetailedOutput $ret1.data
証明書情報取得
openssl s_client -connect example.com:443 -servername example.com < /dev/null 2>/dev/null | openssl x509 -noout -text | grep -e "Not After" -e "DNS"
【Azure PowerShell】AppServiceのftps状態一覧取得
$WebApps = Get-AzureRmWebApp; for($i = 0; $i -lt $WebApps.Count; $i++) { $Resource = Get-AzureRmResource -ResourceType "microsoft.web/sites/config" -ResourceGroupName $WebApps[$i].ResourceGroup -ResourceName $WebApps[$i].Name -ApiVersion '2016-08-01'; $message = $WebApps[$i].Name + ":" + $Resource.Properties.ftpsState; Write-Output $message; }
【Azure PowerShell】SecurityGroupRule一覧取得
Get-AzureRmNetworkSecurityGroup -Name xxxxx -ResourceGroupName xxxxx | Get-AzureRmNetworkSecurityRuleConfig | Sort-Object -Property Priority | format-table -property Name,Protocol,SourcePortRange,DestinationPortRange,SourceAddressPrefix,DestinationAddressPrefix,Access,Priority,Direction,Description -autosize
【Azure CLI】vmコア数一覧取得
az vm list -o tsv --query "[].[name, location, hardwareProfile.vmSize]"