Skip to content

Commit 7f29b64

Browse files
author
Kimmo Forss
committed
Update troubleshooting guide
1 parent ad790fc commit 7f29b64

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

articles/sap/automation/troubleshooting.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,78 @@ Agent_IP = "10.0.0.5"
6464
public_network_access_enabled = true
6565
```
6666

67+
### Failed to get existing workspaces error
68+
69+
If you see an error similar to the following when running the deployment:
70+
71+
```text
72+
Error: : Error retrieving keys for Storage Account "mgmtweeutfstate###": azure.BearerAuthorizer#WithAuthorization: Failed to refresh the Token for request to
73+
https://management.azure.com/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MGMT-WEEU-SAP_LIBRARY/providers/Microsoft.Storage/storageAccounts/mgmtweeutfstate###/listKeys?api-version=2021-01-01
74+
: StatusCode=400 -- Original Error: adal: Refresh request failed. Status Code = '400'. Response body: {"error":"invalid_request","error_description":"Identity not found"} Endpoint
75+
http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&client_id=yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy&resource=https%3A%2F%2Fmanagement.azure.com%2F
76+
```
77+
78+
This error indicates that the credentials used to do the deployment doesn't have access to the storage account. To resolve this issue, assign the 'Storage Account Contributor' role to the deployment credential on the terraform state storage account, the resource group or the subscription (if feasible).
79+
80+
You can verify if the deployment is being performed using a service principal or a managed identity by checking the output of the deployment. If the deployment is using a service principal, the output will contain the following:
81+
82+
```text
83+
[set_executing_user_environment_variables]: Identifying the executing user and client
84+
[set_azure_cloud_environment]: Identifying the executing cloud environment
85+
[set_azure_cloud_environment]: Azure cloud environment: public
86+
[set_executing_user_environment_variables]: User type: servicePrincipal
87+
[set_executing_user_environment_variables]: client id: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
88+
[set_executing_user_environment_variables]: Identified login type as 'service principal'
89+
[set_executing_user_environment_variables]: Initializing state with SPN named: <SPN Name>
90+
[set_executing_user_environment_variables]: exporting environment variables
91+
[set_executing_user_environment_variables]: ARM environment variables:
92+
ARM_CLIENT_ID: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
93+
ARM_SUBSCRIPTION_ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
94+
ARM_USE_MSI: false
95+
```
96+
97+
Look for the following line in the output: "ARM_USE_MSI: false"
98+
99+
If the deployment is using a managed identity, the output will contain the following:
100+
101+
```text
102+
103+
[set_executing_user_environment_variables]: Identifying the executing user and client
104+
[set_azure_cloud_environment]: Identifying the executing cloud environment
105+
[set_azure_cloud_environment]: Azure cloud environment: public
106+
[set_executing_user_environment_variables]: User type: servicePrincipal
107+
[set_executing_user_environment_variables]: client id: systemAssignedIdentity
108+
[set_executing_user_environment_variables]: logged in using 'servicePrincipal'
109+
[set_executing_user_environment_variables]: unset ARM_CLIENT_SECRET
110+
[set_executing_user_environment_variables]: ARM environment variables:
111+
ARM_CLIENT_ID: zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
112+
ARM_SUBSCRIPTION_ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
113+
ARM_USE_MSI: true
114+
```
115+
116+
Look for the following line in the output: "ARM_USE_MSI: true"
117+
118+
You can assign the 'Storage Account Contributor' role to the deployment credential on the terraform state storage account, the resource group or the subscription (if feasible). Use the ARM_CLIENT_ID from the deployment output.
119+
120+
```cloudshell-interactive
121+
export appId="<ARM_CLIENT_ID>"
122+
123+
az role assignment create --assignee ${appId} \
124+
--role "Storage Account Contributor" \
125+
--scope /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/MGMT-WEEU-SAP_LIBRARY/providers/Microsoft.Storage/storageAccounts/mgmtweeutfstate###
126+
```
127+
128+
You may also need to assign the reader role to the deployment credential on the subscription containing the resource group with the Terrafrom state file. You can do that with the following command:
129+
130+
```cloudshell-interactive
131+
export appId="<ARM_CLIENT_ID>"
132+
133+
az role assignment create --assignee ${appId} \
134+
--role "Reader" \
135+
--scope /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
136+
```
137+
138+
67139
### OverconstrainedAllocationRequest error
68140
If you see an error similar to the following when running the deployment:
69141

0 commit comments

Comments
 (0)