Skip to content

Commit 096c568

Browse files
authored
Merge pull request #262614 from KimForss/main
Add a section on credentials for terrafrom state file
2 parents 1303978 + 5ac028f commit 096c568

File tree

1 file changed

+110
-5
lines changed

1 file changed

+110
-5
lines changed

articles/sap/automation/troubleshooting.md

Lines changed: 110 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This section describes how to troubleshoot issues that you can encounter when pe
4444

4545
### Unable to access keyvault: XXXXX error
4646

47-
If you see an error similar to the following when running the deployment:
47+
If you see an error similar to the following error when running the deployment:
4848

4949
```text
5050
Unable to access keyvault: XXXXYYYYDEP00userBEB
@@ -55,7 +55,7 @@ This error indicates that the specified key vault doesn't exist or that the depl
5555

5656
Depending on the deployment stage, you can resolve this issue in the following ways:
5757

58-
You can either add the IP of the environment from which you're executing the deployment (recommended) or you can allow public access to the key vault. See [Allow public access to a key vault](/azure/key-vault/general/network-security#allow-public-access-to-a-key-vault) for more information.
58+
You can either add the IP of the environment from which you're executing the deployment (recommended) or you can allow public access to the key vault. For more information about controlling access to the key vault, see [Allow public access to a key vault](/azure/key-vault/general/network-security#allow-public-access-to-a-key-vault).
5959

6060
The following variables are used to configure the key vault access:
6161

@@ -64,8 +64,113 @@ 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 error 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 contains the following section:
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 contains the following section:
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 Terraform 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+
### Private DNS Zone Name 'xxx' wasn't found
139+
140+
If you see an error similar to the following error when running the deployment:
141+
142+
```text
143+
Private DNS Zone Name: "privatelink.file.core.windows.net" was not found
144+
145+
or
146+
147+
Private DNS Zone Name: "privatelink.blob.core.windows.net" was not found
148+
149+
or
150+
151+
Private DNS Zone Name: "privatelink.vaultcore.azure.net" was not found
152+
153+
```
154+
155+
This error indicates that the Private DNS zone listed in the error isn't available. You can resolve this issue by either creating the Private DNS or providing the configuration for an existing private DNS Zone. For more information on how to create the Private DNS Zone, see [Create a private DNS zone](/azure/dns/private-dns-getstarted-cli#create-a-private-dns-zone).
156+
157+
You can specify the details for an existing private DNS zone by using the following variables:
158+
159+
```terraform
160+
# Resource group name for resource group that contains the private DNS zone
161+
management_dns_resourcegroup_name="<resource group name for the Private DNS Zone>"
162+
163+
# Subscription ID name for resource group that contains the private DNS zone
164+
management_dns_subscription_id="<subscription id for resource group name for the Private DNS Zone>"
165+
166+
use_custom_dns_a_registration=false
167+
168+
```
169+
170+
Rerun the deployment after you made these changes.
171+
67172
### OverconstrainedAllocationRequest error
68-
If you see an error similar to the following when running the deployment:
173+
If you see an error similar to the following error when running the deployment:
69174

70175
```text
71176
Virtual Machine Name: "devsap01app01": Code="OverconstrainedAllocationRequest" Message="Allocation failed. VM(s) with the following constraints cannot be allocated, because the condition is too restrictive. Please remove some constraints and try again. Constraints applied are:
@@ -98,7 +203,7 @@ If you see an error similar to the following message when running the deployment
98203
ERROR! this task 'ansible.builtin.command' has extra params, which is only allowed in the following modules: set_fact, shell, include_tasks, win_shell, import_tasks, import_role, include, win_command, command, include_role, meta, add_host, script, group_by, raw, include_vars
99204
```
100205

101-
This error indicates that the task isn't supported by the version of Ansible that is installed. To resolve this issue, upgrade to the latest version of Ansible on the agent virtual machine.
206+
This error indicates that the version of Ansible installed on the agent doesn't support this task. To resolve this issue, upgrade to the latest version of Ansible on the agent virtual machine.
102207

103208
## Software download
104209

@@ -121,7 +226,7 @@ If you see an error similar to the following message when running the Azure Pipe
121226
##[error]Bash exited with code '2'.
122227
```
123228

124-
This error indicates that the configured personal access token doesn't have permissions to access the variable group. Ensure that the personal access token has the **Read & manage** permission for the variable group and that it hasn't expired. The personal access token is configured in the Azure DevOps pipeline variable groups either as 'PAT' in the control plane variable group or as WZ_PAT in the workload zone variable group.
229+
This error indicates that the configured personal access token doesn't have permissions to access the variable group. Ensure that the personal access token has the **Read & manage** permission for the variable group and that it's still valid. The personal access token is configured in the Azure DevOps pipeline variable groups either as 'PAT' in the control plane variable group or as 'WZ_PAT' in the workload zone variable group.
125230

126231

127232
## Next step

0 commit comments

Comments
 (0)