Azure / Azure/azure-quickstart-templates

Failed to Create Azure Service principal using Microsoft.Resources/deploymentScripts

Open
#9,563 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

### Issue Details

I want to use `Microsoft.Resources/deploymentScripts` run script to create `service principal`, but it can not successfully create

template: [azuredeploy.json](https://raw.githubusercontent.com/kaka-lin/azure-notes/master/arm-template/templates/media-services-and-principal/azuredeploy.json)

script: [meida-service.sh](https://raw.githubusercontent.com/kaka-lin/azure-notes/master/arm-template/templates/media-services-and-principal/scripts/meida-service.sh)

If I use ARM template to create Storage and Media Service and use `azure-cli` or `cloudshell` run the script file, it can successfully create `service principal` and get `name`, `secret`

But if I use ARM template to create Storage and Media Service and use `Microsoft.Resources/deploymentScripts` run the same script file, it can not successfully create service principal

#### For example

```bash
AAD_SERVICE_PRINCIPAL_SECRET=$(az ams account sp create --resource-group ${RESOURCE_GROUP} --account-name ${AMS_ACCOUNT} | jq ".AadSecret")
echo $AAD_SERVICE_PRINCIPAL_SECRET
```

this command if using `Microsoft.Resources/deploymentScripts` would get empty string

But if using `azure-cli` or `cloudshell` can get principal_secret

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with azuredeploy.json and scripts/meida-service.sh from the linked template, then compare the deploymentScripts execution with running the same command in Azure CLI or Cloud Shell. Check the output of az ams account sp create and its jq extraction in both environments. Done means explaining why the deployment script returns an empty secret and documenting or correcting the template or script behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, shell
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.