Forum Discussion
sagar1203
Jan 03, 2024Copper Contributor
Error: You do not have permission to view this directory or page
I am using AzureResourceManagerTemplateDeployment@3 task to deploy an azure ad b2c tenant using the release pipeline.
When I was manually running the ARM script using my local PowerShell then it was running smoothly and b2c tenant was getting created in resource group, but in release pipeline I got the error as below:
Now the thing is that I tried giving every related admin rights like subscription owner and ad b2c global administrator to the service principal which I am using in the pipeline but that didn't work. I wasn't able to resolve the issue. Could you please help me with this?
Take this:
- Verify Service Principal Permissions: Ensure that the service principal used in the pipeline has the necessary permissions. It should have at least the Contributor role on the subscription and the Global Administrator role in Azure AD B2C.
- Check Azure DevOps Service Connection: Make sure that the service connection in Azure DevOps is correctly configured and has the necessary permissions. You can verify this by navigating to Project Settings > Service connections in Azure DevOps.
- Review ARM Template Deployment Task Configuration: Double-check the configuration of the AzureResourceManagerTemplateDeployment@3 task in your pipeline. Ensure that all required parameters are correctly specified, including the deploymentScope, azureResourceManagerConnection, resourceGroupName, and location.
- Enable Debug Logging: Enable debug logging in your pipeline to get more detailed error messages. You can do this by setting the system.debug variable to true in your pipeline.
- Check for Policy Restrictions: Ensure that there are no Azure policies or resource locks that might be preventing the deployment. You can check this in the Azure portal under Policy and Locks.
- Validate ARM Template: Validate your ARM template to ensure there are no issues with the template itself. You can use the Test-AzResourceGroupDeployment cmdlet in PowerShell to validate the template.
YAML Example:
- task: AzureResourceManagerTemplateDeployment@3 inputs: deploymentScope: 'Resource Group' azureResourceManagerConnection: 'YourServiceConnection' action: 'Create Or Update Resource Group' resourceGroupName: 'YourResourceGroupName' location: 'YourLocation' templateLocation: 'Linked artifact' csmFile: '$(System.DefaultWorkingDirectory)/path/to/your/template.json' csmParametersFile: '$(System.DefaultWorkingDirectory)/path/to/your/parameters.json' deploymentMode: 'Incremental'