Unable to register Azure CDN as an app using Powershell

Nicen 1 Reputation point
2020-08-13T06:59:55.07+00:00

Dear support,

I need your help with the below issue.

I was trying to register Azure CDN as an app using PowerShell and I found this article "https://github.com/MicrosoftDocs/azure-docs/commit/080f0d88908a563b2c47759ac2b4facd38ec487b" and I tried to follow the mentioned steps but I got below error when I run "New-AzureRmADServicePrincipal -ApplicationId "205478c0-bd83-4e1b-a9d6-db63a3e1e1c8"

The Error is:

New-AzureRmADServicePrincipal : Object reference not set to an instance of an object. At line:1 char:1 + New-AzureRmADServicePrincipal -ApplicationId 205478c0-bd83-4e1b-a9d6- ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [New-AzureRmADServicePrincipal], NullReferenceException + FullyQualifiedErrorId : Microsoft.Azure.Commands.ActiveDirectory.NewAzureADServicePrincipalCommand

Attached screenshot for more info.

![17347-error.jpg][1]

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
38,663 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. JamesTran-MSFT 36,596 Reputation points Microsoft Employee
    2020-08-13T20:34:20.01+00:00

    @Nicen
    It looks like you might have one too many quotes within your PS command, which could've caused the Application ID to not actually reference an object or App in this case. Can you try running the below command. You can do so using Azure PowerShell on your desktop or Azure Cloud Shell within the Portal. Keep in mind that if you're using your desktop you'll need AzureRM modules unless you'd like to use the Az commands to create a service principle.

    New-AzureRmADServicePrincipal -ApplicationId "205478c0-bd83-4e1b-a9d6-db63a3e1e1c8"

    17484-cdnsp.jpg

    If you have any other questions please let me know.
    Thank you for your time!

    Additional Links:
    Create a service principal
    Create a new AD service principal using application id with role assignment


  2. James Hamil 24,311 Reputation points Microsoft Employee
    2020-08-31T19:07:25.15+00:00

    Hi, are there any updates with this case? If not, please select the appropriate response as "Answered." Otherwise please let us know how we can assist you.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.