0
votes

I am trying to follow azure documetation to create sp: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-authenticate-service-principal-cli

Followed steps for sp using certificate method until here and facing the error when I execute this command: azure ad sp create -n exampleapp --cert-value {certificate data}

> rawStack: [Getter] } Error   <<< async stack >>>   at __1
> (/usr/local/lib/node_modules/azure-cli/lib/commands/arm/ad/ad.servicePrincipals.js:174:41)   at __3
> (/usr/local/lib/node_modules/azure-cli/lib/commands/arm/ad/ad.servicePrincipals.js:172:30)   <<< raw stack >>>
>     at /usr/local/lib/node_modules/azure-cli/node_modules/azure-graph/lib/operations/servicePrincipals.js:128:19
>     at retryCallback (/usr/local/lib/node_modules/azure-cli/node_modules/ms-rest/lib/filters/systemErrorRetryPolicyFilter.js:89:9)
>     at retryCallback (/usr/local/lib/node_modules/azure-cli/node_modules/ms-rest/lib/filters/exponentialRetryPolicyFilter.js:140:9)
>     at handleRedirect (/usr/local/lib/node_modules/azure-cli/node_modules/ms-rest/lib/filters/redirectFilter.js:39:9)
>     at /usr/local/lib/node_modules/azure-cli/node_modules/ms-rest-azure/lib/filters/rpRegistrationFilter.js:59:14
>     at /usr/local/lib/node_modules/azure-cli/lib/util/utils.js:613:7
>     at handleRedirect (/usr/local/lib/node_modules/azure-cli/lib/util/utils.js:590:9)
>     at /usr/local/lib/node_modules/azure-cli/lib/util/logging.js:331:7
>     at Request._callback (/usr/local/lib/node_modules/azure-cli/node_modules/ms-rest/lib/requestPipeline.js:125:16)
>     at Request.self.callback (/usr/local/lib/node_modules/azure-cli/node_modules/request/request.js:187:22)
1
Have you install Azure CLI 1.0? please ust this command to check it azure --version.Jason Ye

1 Answers

1
votes

For now, Azure have CLI 1.0 and CLI 2.0.

CLI 1.0 command like this: azure ad sp

CLI 2.0 command like this: az ad sp

We can use this command to check it: azure --version or az --version

If you install CLI 2.0, we can use this command to create SP:

az ad sp create-for-rbac --name {appId} --password "{strong password}" 

More information about use CLI 2.0 to create SP, please refer to this article.


Update:

If you want to use CLI 1.0 to create SP, the --cert-value represents the base 64 encoded certificate.

We can use PowerShell to encoding it, please refer to this link.