One day I started to look if one could set cloud shell storage by default for Azure users of the tenant and managed to break down the access to cloud shell. I needed another way to reset the cloud shell settings that through the cloud shell. Annoyingly, at the time of this posting this is not available any other way than through REST or through CLI/PowerShell.
The only information I was able to find was this troubleshooting guide (https://docs.microsoft.com/en-us/azure/cloud-shell/troubleshooting).
Here is the way you can access Cloud Shell settings without the Azure Portal with bash shell with CLI:
Login to Azure CLI:
az login
Get the bearer token of control plane for REST access:
token="Bearer $(az account get-access-token --resource https://management.azure.com/ -o tsv --query accessToken)"
Export the configuration using the token:
curl https://management.azure.com/providers/Microsoft.Portal/usersettings/cloudconsole?api-version=2017-12-01-preview -H Authorization:"$token" -s | jq
This will output the cloud shell configuration:
{
"properties": {
"preferredOsType": "Linux",
"preferredLocation": "westeurope",
"storageProfile": {
"storageAccountResourceId": "/subscriptions/******************/resourcegroups/rg-**********/providers/Microsoft.Storage/storageAccounts/sacs*********",
"fileShareName": "fscs*********",
"diskSizeInGB": 5
},
"terminalSettings": {
"fontSize": "Medium",
"fontStyle": "Monospace"
}
}
}
THE FOLLOWING COMMAND DELETES THE CURRENT CONIFGURATION! USE AT YOUR OWN RISK:
curl -X DELETE https://management.azure.com/providers/Microsoft.Portal/usersettings/cloudconsole?api-version=2017-12-01-preview -H Authorization:"$token"
This will leave the storage accounts and the other resources intact. Exporting deleted configuration will output the following:
{
"error": {
"code": "UserSettingsNotFound",
"message": "The user settings 'cloudconsole' does not exist."
}
}
Accessing cloud shell after this will open the welcome page:
No comments:
Post a Comment