Azure Cli

  • clouds
# list available clouds
az cloud list --output table
# China Azure
az cloud set --name AzureChinaCloud
  • login
# login service account
az login --service-principal --tenant xxx -u xxx -p xxx

# local
az login

# vm无法使用浏览器,强制使用设备代码流 
az login --use-device-code
# https://microsoft.com/deviceloginchina
  • 访问 aks
az aks get-credentials --resource-group xxx --name xxx
  • get token
az account list

az account get-access-token --resource https://ossrdbms-aad.database.chinacloudapi.cn --output tsv --query accessToken
az account get-access-token --resource-type oss-rdbms --output tsv --query accessToken
  • mysql
mysql -h xxx.mysql.database.chinacloudapi.cn \
    --user xxx@xxx.com.cn \
    --enable-cleartext-plugin \
    --password=`az account get-access-token --resource-type oss-rdbms --output tsv --query accessToken`
 # user 大小写敏感
Category: Cloud

Author: Yoga

Article
Tagcloud
DVA Java Express Architecture Azure CI/CD database ML AWS ETL nest sql AntV Next Deep Learning Flutter TypeScript Angular DevTools Microsoft egg Tableau SAP Token Regexp Unit test Nginx nodeJS sails wechat Jmeter HTML2Canvas Swift Jenkins JS event GTM Algorithm Echarts React-Admin Rest React hook Flux Redux ES6 Route Component Ref AJAX Form JSX Virtual Dom Javascript CSS design pattern