#BICEP - Create App Registration

1 messages · Page 1 of 1 (latest)

red ember
#

Hello there!

I have made in the past using Powershell & Microsoft Graph cmdlet SDK (https://learn.microsoft.com/en-us/powershell/microsoftgraph/get-started?view=graph-powershell-1.0) (And other MS SDK) a project to create an app registration with its permissions, grant admin consent to those permissions, generate a secret and sends those info to an Azure Key vault through an app registration already created (And other stuff such as setup some settings in O365 & Exchange).

I would like to include that project inside my current bicep project to automate new customer onboarding. I know it is not yet possible to deploy using ARM & BICEP App registration directly and you need to use at least script deployment. However my project contains lots of dependencies & functions, and so far all the examples I found were showing very simple scripts in action.

Will it be possible to include such thing and if yes what are your recommendations? I already tried to split a bit the project but it does not like some functions I wrote thus maybe there is a better way (Re-writting completely the code is not a possibility).

The project will be stored in an Azure Storage but will be run on customer's tenant side through that BICEP.

Cheers!

Get started with the Microsoft Graph PowerShell SDK by using it perform some basic tasks.

topaz cave
#

Does it need to bicep ?

red ember
#

I would like to include that project in my all in one bicep deployment.

I already tried (just a little bit) to use the deployment script in Bicep but it's leading me to errors

such as ```
The provided script failed with the following error:

System.Management.Automation.ParameterBindingException: A positional parameter cannot be found that accepts argument 'for'.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary2 functionsToDefine, List1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args) at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at Microsoft.PowerShell.Commands.InvokeExpressionCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()

at <ScriptBlock>, <No file>: line 1

at <ScriptBlock>, /mnt/azscripts/azscriptinput/DeploymentScript.ps1: line 295. Please refer to https://aka.ms/DeploymentScriptsTroubleshoot for more deployment script information. (Code: DeploymentScriptError)


(I don't have any "for" argument lol) but before I'm starting to investigate that I want to see all the possibilities and if there is not a better way

I created my own modules thus I need to be able to import them (I would like to avoid having EVERYTHING in the same powershell script lel)