How to give Azure AD application access to required permissions using powershell Az moduleHow to run a PowerShell scriptHow do you comment out code in PowerShell?Execute Get-AzureRmRoleAssignment as Service Principal in Azure PowershellMissing Microsoft Graph ServicePrincipalPowerShell script to Automate AAD app and assigning delegated PermissionsPowershell - Do “Grant Permissions” action on Azure AD Application with PowershellNew-AzureRmADApplication equivalent of New-AzureADApplication -RequiredResourceAccessAssigning Microsoft Graph permissions to Azure Managed Service IdentityAzure Developer User consent to app accessing company dataAzure client credentials grant oath not working in hybrid setup for Graph Mail API access
Talk interpreter
Why does a sticker slowly peel off, but if it is pulled quickly it tears?
Unlock your Lock
Toroidal Heyacrazy: Rainstorm
Why does this London Underground poster from 1924 have a Star of David atop a Christmas tree?
Alternatives to Network Backup
Term used to describe a person who predicts future outcomes
Why did Lucius make a deal out of Buckbeak hurting Draco but not about Draco being turned into a ferret?
74S vs 74LS ICs
Why does matter stay collapsed in the core, following a supernova explosion?
How many petaflops does it take to land on the moon? What does Artemis need with an Aitken?
What are the IPSE’s, the ASPE’s, the FRIPSE’s and the GRIPSE’s?
Can a paladin prepare more spells if they didn't cast any the previous day?
Half filled water bottle
What is Soda Fountain Etiquette?
Shift lens vs move body?
Defending Castle from Zombies
Is the Amazon rainforest the "world's lungs"?
Can I get a PhD for developing an educational software?
How to prevent a hosting company from accessing a VM's encryption keys?
Which meaning of "must" does the Slow spell use?
Time difference between banns and marriage
What stops you from using fixed income in developing countries?
How can I download a file from a host I can only SSH to through another host?
How to give Azure AD application access to required permissions using powershell Az module
How to run a PowerShell scriptHow do you comment out code in PowerShell?Execute Get-AzureRmRoleAssignment as Service Principal in Azure PowershellMissing Microsoft Graph ServicePrincipalPowerShell script to Automate AAD app and assigning delegated PermissionsPowershell - Do “Grant Permissions” action on Azure AD Application with PowershellNew-AzureRmADApplication equivalent of New-AzureADApplication -RequiredResourceAccessAssigning Microsoft Graph permissions to Azure Managed Service IdentityAzure Developer User consent to app accessing company dataAzure client credentials grant oath not working in hybrid setup for Graph Mail API access
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to rewrite powershell script that creates Azure AD application and assigns permission to it. The script is using AzureAD module, I would like to use new Az module, so I can run it on Linux/MacOS.
Creating a new application is easy (New-AzADApplication) but I have a problem with permissions.
Old script is using this code to assign permissions:
#=============Graph Permissions========================
$req = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess"
$acc1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "df021288-bdef-4463-88db-98f22de89214","Role"
$req.ResourceAccess = $acc1
$req.ResourceAppId = "00000003-0000-0000-c000-000000000000" #Microsoft Graph
Set-AzureADApplication -ObjectId $AppObjectId -RequiredResourceAccess $req
But this will not work on Linux/MacOS. Is there any way to do this? If not from powershell than maybe using some other method? The main goal is to run it from Linux.
azure powershell azure-active-directory az
add a comment |
I'm trying to rewrite powershell script that creates Azure AD application and assigns permission to it. The script is using AzureAD module, I would like to use new Az module, so I can run it on Linux/MacOS.
Creating a new application is easy (New-AzADApplication) but I have a problem with permissions.
Old script is using this code to assign permissions:
#=============Graph Permissions========================
$req = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess"
$acc1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "df021288-bdef-4463-88db-98f22de89214","Role"
$req.ResourceAccess = $acc1
$req.ResourceAppId = "00000003-0000-0000-c000-000000000000" #Microsoft Graph
Set-AzureADApplication -ObjectId $AppObjectId -RequiredResourceAccess $req
But this will not work on Linux/MacOS. Is there any way to do this? If not from powershell than maybe using some other method? The main goal is to run it from Linux.
azure powershell azure-active-directory az
The script you share does not actually grant permissions, is just marks permissions as required. Do you also need to grant the permissions in the tenant?
– Philippe Signoret
Mar 27 at 22:47
@PhilippeSignoret Indeed I need, but this is already solved using admin consent through a URL request - docs.microsoft.com/bs-latn-ba/azure/active-directory/…
– paulpb
Mar 28 at 9:51
add a comment |
I'm trying to rewrite powershell script that creates Azure AD application and assigns permission to it. The script is using AzureAD module, I would like to use new Az module, so I can run it on Linux/MacOS.
Creating a new application is easy (New-AzADApplication) but I have a problem with permissions.
Old script is using this code to assign permissions:
#=============Graph Permissions========================
$req = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess"
$acc1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "df021288-bdef-4463-88db-98f22de89214","Role"
$req.ResourceAccess = $acc1
$req.ResourceAppId = "00000003-0000-0000-c000-000000000000" #Microsoft Graph
Set-AzureADApplication -ObjectId $AppObjectId -RequiredResourceAccess $req
But this will not work on Linux/MacOS. Is there any way to do this? If not from powershell than maybe using some other method? The main goal is to run it from Linux.
azure powershell azure-active-directory az
I'm trying to rewrite powershell script that creates Azure AD application and assigns permission to it. The script is using AzureAD module, I would like to use new Az module, so I can run it on Linux/MacOS.
Creating a new application is easy (New-AzADApplication) but I have a problem with permissions.
Old script is using this code to assign permissions:
#=============Graph Permissions========================
$req = New-Object -TypeName "Microsoft.Open.AzureAD.Model.RequiredResourceAccess"
$acc1 = New-Object -TypeName "Microsoft.Open.AzureAD.Model.ResourceAccess" -ArgumentList "df021288-bdef-4463-88db-98f22de89214","Role"
$req.ResourceAccess = $acc1
$req.ResourceAppId = "00000003-0000-0000-c000-000000000000" #Microsoft Graph
Set-AzureADApplication -ObjectId $AppObjectId -RequiredResourceAccess $req
But this will not work on Linux/MacOS. Is there any way to do this? If not from powershell than maybe using some other method? The main goal is to run it from Linux.
azure powershell azure-active-directory az
azure powershell azure-active-directory az
edited Mar 27 at 20:32
paulpb
asked Mar 27 at 20:20
paulpbpaulpb
133 bronze badges
133 bronze badges
The script you share does not actually grant permissions, is just marks permissions as required. Do you also need to grant the permissions in the tenant?
– Philippe Signoret
Mar 27 at 22:47
@PhilippeSignoret Indeed I need, but this is already solved using admin consent through a URL request - docs.microsoft.com/bs-latn-ba/azure/active-directory/…
– paulpb
Mar 28 at 9:51
add a comment |
The script you share does not actually grant permissions, is just marks permissions as required. Do you also need to grant the permissions in the tenant?
– Philippe Signoret
Mar 27 at 22:47
@PhilippeSignoret Indeed I need, but this is already solved using admin consent through a URL request - docs.microsoft.com/bs-latn-ba/azure/active-directory/…
– paulpb
Mar 28 at 9:51
The script you share does not actually grant permissions, is just marks permissions as required. Do you also need to grant the permissions in the tenant?
– Philippe Signoret
Mar 27 at 22:47
The script you share does not actually grant permissions, is just marks permissions as required. Do you also need to grant the permissions in the tenant?
– Philippe Signoret
Mar 27 at 22:47
@PhilippeSignoret Indeed I need, but this is already solved using admin consent through a URL request - docs.microsoft.com/bs-latn-ba/azure/active-directory/…
– paulpb
Mar 28 at 9:51
@PhilippeSignoret Indeed I need, but this is already solved using admin consent through a URL request - docs.microsoft.com/bs-latn-ba/azure/active-directory/…
– paulpb
Mar 28 at 9:51
add a comment |
1 Answer
1
active
oldest
votes
The Azure CLI is easy to get started with and best used for Microsoft's cross-platform command-line experience for managing Azure resources on macOS, Linux, or Windows and run it from the command line.
Your case
In your case you could try with Following CLI command for application permission:
az ad app permission add --api
--api-permissions
--id
[--subscription]
For example
See add a Graph API permission of "Sign in and read user profile" command below:
az ad app permission add --id eeba0b46-78e5-4a1a-a1aa-cafe6c123456 --api 00000002-0000-0000-c000-000000000000 --api-permissions 311a71cc-e848-46a1-bdf8-97ff7156d8e6=Scope
Required Parameters
Following parameters required for this permission
--api
The target API to access.
--api-permissions
Space seperated list of =.
--id
Identifier uri, application id, or object id.
For more details CLI command you also could refer here
Note :
To executes above command you must need to install the CLI locally,
run it in the browser with Azure Cloud Shell, or run in a Docker
container. For installation reference you could see here
I hope this would be helpful what you expected to do. Let's try it out. Thank you!
@paulpb According to your case you can try it out. Let me know if you have any more query regarding your problem.
– Md Farid Uddin Kiron
Mar 28 at 1:48
Hi, your answer was very helpful. Docker with Azure Cloud Shell looks like the best solution. I'm going to try it right now!
– paulpb
Mar 28 at 9:03
I did, but due to my low reputation, my votes are not displayed.
– paulpb
Mar 28 at 9:47
This answer is copy-pasted from the API reference. But what's still missing is where to find the guid (311a71cc...) mapping to "Sign in and read user profile"?
– Nikolai Koudelia
May 3 at 11:17
@Nikolai Koudelia Right you are, We always try to refer our official document towards the user as I also specified the API reference here. What happens usually, sometimes its tough to find exact resource when need if the document has the exact fix its better to refer them I did the same. Thanks for your comment.
– Md Farid Uddin Kiron
May 3 at 14:49
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385802%2fhow-to-give-azure-ad-application-access-to-required-permissions-using-powershell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The Azure CLI is easy to get started with and best used for Microsoft's cross-platform command-line experience for managing Azure resources on macOS, Linux, or Windows and run it from the command line.
Your case
In your case you could try with Following CLI command for application permission:
az ad app permission add --api
--api-permissions
--id
[--subscription]
For example
See add a Graph API permission of "Sign in and read user profile" command below:
az ad app permission add --id eeba0b46-78e5-4a1a-a1aa-cafe6c123456 --api 00000002-0000-0000-c000-000000000000 --api-permissions 311a71cc-e848-46a1-bdf8-97ff7156d8e6=Scope
Required Parameters
Following parameters required for this permission
--api
The target API to access.
--api-permissions
Space seperated list of =.
--id
Identifier uri, application id, or object id.
For more details CLI command you also could refer here
Note :
To executes above command you must need to install the CLI locally,
run it in the browser with Azure Cloud Shell, or run in a Docker
container. For installation reference you could see here
I hope this would be helpful what you expected to do. Let's try it out. Thank you!
@paulpb According to your case you can try it out. Let me know if you have any more query regarding your problem.
– Md Farid Uddin Kiron
Mar 28 at 1:48
Hi, your answer was very helpful. Docker with Azure Cloud Shell looks like the best solution. I'm going to try it right now!
– paulpb
Mar 28 at 9:03
I did, but due to my low reputation, my votes are not displayed.
– paulpb
Mar 28 at 9:47
This answer is copy-pasted from the API reference. But what's still missing is where to find the guid (311a71cc...) mapping to "Sign in and read user profile"?
– Nikolai Koudelia
May 3 at 11:17
@Nikolai Koudelia Right you are, We always try to refer our official document towards the user as I also specified the API reference here. What happens usually, sometimes its tough to find exact resource when need if the document has the exact fix its better to refer them I did the same. Thanks for your comment.
– Md Farid Uddin Kiron
May 3 at 14:49
|
show 4 more comments
The Azure CLI is easy to get started with and best used for Microsoft's cross-platform command-line experience for managing Azure resources on macOS, Linux, or Windows and run it from the command line.
Your case
In your case you could try with Following CLI command for application permission:
az ad app permission add --api
--api-permissions
--id
[--subscription]
For example
See add a Graph API permission of "Sign in and read user profile" command below:
az ad app permission add --id eeba0b46-78e5-4a1a-a1aa-cafe6c123456 --api 00000002-0000-0000-c000-000000000000 --api-permissions 311a71cc-e848-46a1-bdf8-97ff7156d8e6=Scope
Required Parameters
Following parameters required for this permission
--api
The target API to access.
--api-permissions
Space seperated list of =.
--id
Identifier uri, application id, or object id.
For more details CLI command you also could refer here
Note :
To executes above command you must need to install the CLI locally,
run it in the browser with Azure Cloud Shell, or run in a Docker
container. For installation reference you could see here
I hope this would be helpful what you expected to do. Let's try it out. Thank you!
@paulpb According to your case you can try it out. Let me know if you have any more query regarding your problem.
– Md Farid Uddin Kiron
Mar 28 at 1:48
Hi, your answer was very helpful. Docker with Azure Cloud Shell looks like the best solution. I'm going to try it right now!
– paulpb
Mar 28 at 9:03
I did, but due to my low reputation, my votes are not displayed.
– paulpb
Mar 28 at 9:47
This answer is copy-pasted from the API reference. But what's still missing is where to find the guid (311a71cc...) mapping to "Sign in and read user profile"?
– Nikolai Koudelia
May 3 at 11:17
@Nikolai Koudelia Right you are, We always try to refer our official document towards the user as I also specified the API reference here. What happens usually, sometimes its tough to find exact resource when need if the document has the exact fix its better to refer them I did the same. Thanks for your comment.
– Md Farid Uddin Kiron
May 3 at 14:49
|
show 4 more comments
The Azure CLI is easy to get started with and best used for Microsoft's cross-platform command-line experience for managing Azure resources on macOS, Linux, or Windows and run it from the command line.
Your case
In your case you could try with Following CLI command for application permission:
az ad app permission add --api
--api-permissions
--id
[--subscription]
For example
See add a Graph API permission of "Sign in and read user profile" command below:
az ad app permission add --id eeba0b46-78e5-4a1a-a1aa-cafe6c123456 --api 00000002-0000-0000-c000-000000000000 --api-permissions 311a71cc-e848-46a1-bdf8-97ff7156d8e6=Scope
Required Parameters
Following parameters required for this permission
--api
The target API to access.
--api-permissions
Space seperated list of =.
--id
Identifier uri, application id, or object id.
For more details CLI command you also could refer here
Note :
To executes above command you must need to install the CLI locally,
run it in the browser with Azure Cloud Shell, or run in a Docker
container. For installation reference you could see here
I hope this would be helpful what you expected to do. Let's try it out. Thank you!
The Azure CLI is easy to get started with and best used for Microsoft's cross-platform command-line experience for managing Azure resources on macOS, Linux, or Windows and run it from the command line.
Your case
In your case you could try with Following CLI command for application permission:
az ad app permission add --api
--api-permissions
--id
[--subscription]
For example
See add a Graph API permission of "Sign in and read user profile" command below:
az ad app permission add --id eeba0b46-78e5-4a1a-a1aa-cafe6c123456 --api 00000002-0000-0000-c000-000000000000 --api-permissions 311a71cc-e848-46a1-bdf8-97ff7156d8e6=Scope
Required Parameters
Following parameters required for this permission
--api
The target API to access.
--api-permissions
Space seperated list of =.
--id
Identifier uri, application id, or object id.
For more details CLI command you also could refer here
Note :
To executes above command you must need to install the CLI locally,
run it in the browser with Azure Cloud Shell, or run in a Docker
container. For installation reference you could see here
I hope this would be helpful what you expected to do. Let's try it out. Thank you!
answered Mar 28 at 1:23
Md Farid Uddin KironMd Farid Uddin Kiron
4,0083 gold badges4 silver badges25 bronze badges
4,0083 gold badges4 silver badges25 bronze badges
@paulpb According to your case you can try it out. Let me know if you have any more query regarding your problem.
– Md Farid Uddin Kiron
Mar 28 at 1:48
Hi, your answer was very helpful. Docker with Azure Cloud Shell looks like the best solution. I'm going to try it right now!
– paulpb
Mar 28 at 9:03
I did, but due to my low reputation, my votes are not displayed.
– paulpb
Mar 28 at 9:47
This answer is copy-pasted from the API reference. But what's still missing is where to find the guid (311a71cc...) mapping to "Sign in and read user profile"?
– Nikolai Koudelia
May 3 at 11:17
@Nikolai Koudelia Right you are, We always try to refer our official document towards the user as I also specified the API reference here. What happens usually, sometimes its tough to find exact resource when need if the document has the exact fix its better to refer them I did the same. Thanks for your comment.
– Md Farid Uddin Kiron
May 3 at 14:49
|
show 4 more comments
@paulpb According to your case you can try it out. Let me know if you have any more query regarding your problem.
– Md Farid Uddin Kiron
Mar 28 at 1:48
Hi, your answer was very helpful. Docker with Azure Cloud Shell looks like the best solution. I'm going to try it right now!
– paulpb
Mar 28 at 9:03
I did, but due to my low reputation, my votes are not displayed.
– paulpb
Mar 28 at 9:47
This answer is copy-pasted from the API reference. But what's still missing is where to find the guid (311a71cc...) mapping to "Sign in and read user profile"?
– Nikolai Koudelia
May 3 at 11:17
@Nikolai Koudelia Right you are, We always try to refer our official document towards the user as I also specified the API reference here. What happens usually, sometimes its tough to find exact resource when need if the document has the exact fix its better to refer them I did the same. Thanks for your comment.
– Md Farid Uddin Kiron
May 3 at 14:49
@paulpb According to your case you can try it out. Let me know if you have any more query regarding your problem.
– Md Farid Uddin Kiron
Mar 28 at 1:48
@paulpb According to your case you can try it out. Let me know if you have any more query regarding your problem.
– Md Farid Uddin Kiron
Mar 28 at 1:48
Hi, your answer was very helpful. Docker with Azure Cloud Shell looks like the best solution. I'm going to try it right now!
– paulpb
Mar 28 at 9:03
Hi, your answer was very helpful. Docker with Azure Cloud Shell looks like the best solution. I'm going to try it right now!
– paulpb
Mar 28 at 9:03
I did, but due to my low reputation, my votes are not displayed.
– paulpb
Mar 28 at 9:47
I did, but due to my low reputation, my votes are not displayed.
– paulpb
Mar 28 at 9:47
This answer is copy-pasted from the API reference. But what's still missing is where to find the guid (311a71cc...) mapping to "Sign in and read user profile"?
– Nikolai Koudelia
May 3 at 11:17
This answer is copy-pasted from the API reference. But what's still missing is where to find the guid (311a71cc...) mapping to "Sign in and read user profile"?
– Nikolai Koudelia
May 3 at 11:17
@Nikolai Koudelia Right you are, We always try to refer our official document towards the user as I also specified the API reference here. What happens usually, sometimes its tough to find exact resource when need if the document has the exact fix its better to refer them I did the same. Thanks for your comment.
– Md Farid Uddin Kiron
May 3 at 14:49
@Nikolai Koudelia Right you are, We always try to refer our official document towards the user as I also specified the API reference here. What happens usually, sometimes its tough to find exact resource when need if the document has the exact fix its better to refer them I did the same. Thanks for your comment.
– Md Farid Uddin Kiron
May 3 at 14:49
|
show 4 more comments
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385802%2fhow-to-give-azure-ad-application-access-to-required-permissions-using-powershell%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The script you share does not actually grant permissions, is just marks permissions as required. Do you also need to grant the permissions in the tenant?
– Philippe Signoret
Mar 27 at 22:47
@PhilippeSignoret Indeed I need, but this is already solved using admin consent through a URL request - docs.microsoft.com/bs-latn-ba/azure/active-directory/…
– paulpb
Mar 28 at 9:51