Azure-Samples / active-directory-aspnetcore-webapp-openidconnect-v2

An ASP.NET Core Web App which lets sign-in users (including in your org, many orgs, orgs + personal accounts, sovereign clouds) and call Web APIs (including Microsoft Graph)
MIT License
1.38k stars 995 forks source link

Running .\Configure.ps1 for 2-3-Multi-Tenant throws an error #785

Open josephsctan opened 1 month ago

josephsctan commented 1 month ago

Microsoft.Identity.Web version

NA

Web app sign-in

Not applicable

Web API (call Graph or downstream APIs)

2-WebApp-graph-user/2-3-Multi-Tenant

Deploy to Azure

Not applicable

Auth Z

Not applicable

Description

When running .\Configure.ps1 in the folder 2-WebApp-graph-user\2-3-Multi-Tenant\AppCreationScripts the following error is shown after login:

System.Management.Automation.ParameterBindingArgumentTransformationException: Cannot process argument transformation on parameter 'BodyParameter'. Cannot convert the "=" value of type "System.String" to type "Microsoft.Graph.PowerShell.Models.IReferenceCreate".
 ---> System.Management.Automation.ArgumentTransformationMetadataException: Cannot convert the "=" value of type "System.String" to type "Microsoft.Graph.PowerShell.Models.IReferenceCreate".
 ---> System.Management.Automation.PSInvalidCastException: Cannot convert the "=" value of type "System.String" to type "Microsoft.Graph.PowerShell.Models.IReferenceCreate".
   at System.Management.Automation.LanguagePrimitives.ConvertCheckingForCustomConverter.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable)
   at System.Management.Automation.LanguagePrimitives.ConvertTo(Object valueToConvert, Type resultType, Boolean recursion, IFormatProvider formatProvider, TypeTable backupTypeTable)
   at System.Management.Automation.ArgumentTypeConverterAttribute.Transform(EngineIntrinsics engineIntrinsics, Object inputData, Boolean bindingParameters, Boolean bindingScriptCmdlet)
   --- End of inner exception stack trace ---
   at System.Management.Automation.ArgumentTypeConverterAttribute.Transform(EngineIntrinsics engineIntrinsics, Object inputData, Boolean bindingParameters, Boolean bindingScriptCmdlet)
   at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
WARNING: Cannot process argument transformation on parameter 'BodyParameter'. Cannot convert the "=" value of type "System.String" to type "Microsoft.Graph.PowerShell.Models.IReferenceCreate".
Unable to register apps. Error is Cannot process argument transformation on parameter 'BodyParameter'. Cannot convert the "=" value of type "System.String" to type "Microsoft.Graph.PowerShell.Models.IReferenceCreate"..```

### Reproduction steps

1. Run .\Configure -TenantId "your tenant id" 
2. Error occurs

### Error message

_No response_

### Id Web logs

_No response_

### Relevant code snippets

```csharp
Not applicable. However, the following powershell modules are installed: 

Version              Name                                Repository           Description
-------              ----                                ----------           -----------
8.2.0                Az                                  PSGallery            Microsoft Azure PowerShell - Cmdlets to manage resources in Azure. This module is compa…
2.9.1                Az.Accounts                         PSGallery            Microsoft Azure PowerShell - Accounts credential management cmdlets for Azure Resource …
1.1.2                Az.Advisor                          PSGallery            Microsoft Azure PowerShell - Azure Advisor Cmdlets for Advisor in Windows PowerShell an…
4.2.1                Az.Aks                              PSGallery            Microsoft Azure PowerShell - Azure managed Kubernetes cmdlets for Windows PowerShell an…
1.1.4                Az.AnalysisServices                 PSGallery            Microsoft Azure PowerShell - Analysis Services cmdlets for Windows PowerShell and Power…
3.0.0                Az.ApiManagement                    PSGallery            Microsoft Azure PowerShell - Api Management service cmdlets for Azure Resource Manager …
1.1.0                Az.AppConfiguration                 PSGallery            Microsoft Azure PowerShell: AppConfiguration cmdlets
2.1.0                Az.ApplicationInsights              PSGallery            Microsoft Azure PowerShell: ApplicationInsights cmdlets
1.0.0                Az.Attestation                      PSGallery            Microsoft Azure PowerShell - Attestation service cmdlets for Azure Resource Manager in …
1.7.3                Az.Automation                       PSGallery            Microsoft Azure PowerShell - Automation service cmdlets for Azure Resource Manager in W…
3.2.0                Az.Batch                            PSGallery            Microsoft Azure PowerShell - Batch service cmdlets for Azure Resource Manager in Window…
2.0.0                Az.Billing                          PSGallery            Microsoft Azure PowerShell - Billing service cmdlets for Azure Resource Manager in Wind…
2.1.0                Az.Cdn                              PSGallery            Microsoft Azure PowerShell: Cdn cmdlets
1.1.0                Az.CloudService                     PSGallery            Microsoft Azure PowerShell: CloudService cmdlets
1.11.0               Az.CognitiveServices                PSGallery            Microsoft Azure PowerShell - Cognitive Services management cmdlets for Azure Resource M…
4.30.0               Az.Compute                          PSGallery            Microsoft Azure PowerShell - Compute service cmdlets for Azure Resource Manager in Wind…
1.0.0                Az.ConfidentialLedger               PSGallery            Microsoft Azure PowerShell: ConfidentialLedger cmdlets
3.1.0                Az.ContainerInstance                PSGallery            Microsoft Azure PowerShell: ContainerInstance cmdlets
3.0.0                Az.ContainerRegistry                PSGallery            Microsoft Azure PowerShell - Container Registry service cmdlets for Azure Resource Mana…
1.8.2                Az.CosmosDB                         PSGallery            Microsoft Azure PowerShell - CosmosDB service cmdlets for Azure Resource Manager in Win…
1.1.0                Az.DataBoxEdge                      PSGallery            Microsoft Azure PowerShell - DataBoxEdge service cmdlets for Azure Resource Manager in …
1.2.0                Az.Databricks                       PSGallery            Microsoft Azure PowerShell: Databricks cmdlets
1.16.8               Az.DataFactory                      PSGallery            Microsoft Azure PowerShell - Data Factory service cmdlets for Azure Resource Manager in…
1.0.2                Az.DataLakeAnalytics                PSGallery            Microsoft Azure PowerShell - Data Lake Analytics in Windows PowerShell and PowerShell C…
1.3.0                Az.DataLakeStore                    PSGallery            Microsoft Azure PowerShell - Azure Data Lake Store cmdlets in Windows PowerShell and Po…
1.0.1                Az.DataShare                        PSGallery            Microsoft Azure PowerShell - DataShare service cmdlets for Azure Resource Manager in Wi…
1.1.0                Az.DeploymentManager                PSGallery            PowerShell .Net Core Microsoft Azure PowerShell - Deployment Manager cmdlets for Azure …
3.1.0                Az.DesktopVirtualization            PSGallery            Microsoft Azure PowerShell: DesktopVirtualization cmdlets
1.0.2                Az.DevTestLabs                      PSGallery            Microsoft Azure PowerShell - DevTest Labs service cmdlets for Azure Resource Manager in…
1.1.2                Az.Dns                              PSGallery            Microsoft Azure PowerShell - DNS service cmdlets for Azure Resource Manager in Windows …
1.3.0                Az.EventGrid                        PSGallery            Microsoft Azure PowerShell - Event Grid service cmdlets for Azure Resource Manager in W…
2.2.0                Az.EventHub                         PSGallery            Microsoft Azure PowerShell - Event Hubs service cmdlets for Azure Resource Manager in W…
1.9.0                Az.FrontDoor                        PSGallery            Microsoft Azure PowerShell - Front Door service cmdlets for Azure Resource Manager in W…
4.0.3                Az.Functions                        PSGallery            Microsoft Azure PowerShell - Azure Functions service cmdlets for Azure Resource Manager…
5.0.1                Az.HDInsight                        PSGallery            Microsoft Azure PowerShell - HDInsight service cmdlets for Azure Resource Manager in Wi…
2.0.0                Az.HealthcareApis                   PSGallery            Microsoft Azure PowerShell: HealthcareApis cmdlets
2.7.4                Az.IotHub                           PSGallery            Microsoft Azure PowerShell - IoT Hub service cmdlets for Azure Resource Manager in Wind…
4.6.1                Az.KeyVault                         PSGallery            Microsoft Azure PowerShell - Key Vault service cmdlets for Azure Resource Manager in Wi…
2.1.0                Az.Kusto                            PSGallery            Microsoft Azure PowerShell: Kusto cmdlets
1.5.0                Az.LogicApp                         PSGallery            Microsoft Azure PowerShell - Logic Apps cmdlets for Azure Resource Manager in Windows P…
1.1.3                Az.MachineLearning                  PSGallery            Microsoft Azure PowerShell - Machine Learning Web Services cmdlets for Azure Resource M…
1.2.0                Az.Maintenance                      PSGallery            Microsoft Azure PowerShell - Maintenance cmdlets for Azure Resource Manager in Windows …
1.0.0                Az.ManagedServiceIdentity           PSGallery            Microsoft Azure PowerShell: ManagedServiceIdentity cmdlets
3.0.0                Az.ManagedServices                  PSGallery            Microsoft Azure PowerShell: ManagedServices cmdlets
1.0.2                Az.MarketplaceOrdering              PSGallery            Microsoft Azure PowerShell - Marketplace Ordering agreements service cmdlets for Azure …
1.1.1                Az.Media                            PSGallery            Microsoft Azure PowerShell - Media service cmdlets for Azure Resource Manager in Window…
1.1.3                Az.Migrate                          PSGallery            Microsoft Azure PowerShell: Migrate cmdlets
3.0.1                Az.Monitor                          PSGallery            Microsoft Azure PowerShell - Monitor service cmdlets for Azure Resource Manager in Wind…
1.0.0                Az.MySql                            PSGallery            Microsoft Azure PowerShell: MySql cmdlets
4.19.0               Az.Network                          PSGallery            Microsoft Azure PowerShell - Networking service cmdlets for Azure Resource Manager in W…
1.1.1                Az.NotificationHubs                 PSGallery            Microsoft Azure PowerShell - Notification Hubs cmdlets for Azure Resource Manager in Wi…
3.1.0                Az.OperationalInsights              PSGallery            Microsoft Azure PowerShell - Operational Insights service cmdlets for Azure Resource Ma…
1.5.0                Az.PolicyInsights                   PSGallery            Microsoft Azure PowerShell - Azure Policy Insights cmdlets for Windows PowerShell and P…
1.1.0                Az.PostgreSql                       PSGallery            Microsoft Azure PowerShell: PostgreSql cmdlets
1.2.0                Az.PowerBIEmbedded                  PSGallery            Microsoft Azure PowerShell - Power BI Embedded service management cmdlets for Azure Res…
1.0.3                Az.PrivateDns                       PSGallery            Microsoft Azure PowerShell - Private DNS service cmdlets for Azure Resource Manager in …
5.4.1                Az.RecoveryServices                 PSGallery            Microsoft Azure PowerShell - Recovery Services cmdlets for Azure Resource Manager in Wi…
1.6.0                Az.RedisCache                       PSGallery            Microsoft Azure PowerShell - Redis Cache service cmdlets for Azure Resource Manager in …
1.1.0                Az.RedisEnterpriseCache             PSGallery            Microsoft Azure PowerShell: RedisEnterpriseCache cmdlets
1.0.3                Az.Relay                            PSGallery            Microsoft Azure PowerShell - Relay service cmdlets for Azure Resource Manager in Window…
1.1.0                Az.ResourceMover                    PSGallery            Microsoft Azure PowerShell: ResourceMover cmdlets
6.1.0                Az.Resources                        PSGallery            Microsoft Azure PowerShell - Azure Resource Manager and Active Directory cmdlets in Win…
1.3.0                Az.Security                         PSGallery            Microsoft Azure PowerShell - Azure Security Center cmdlets in Windows PowerShell and Po…
1.1.0                Az.SecurityInsights                 PSGallery            Microsoft Azure PowerShell - Azure Sentinel cmdlets in Windows PowerShell and PowerShel…
1.10.0               Az.ServiceBus                       PSGallery            Microsoft Azure PowerShell - Service Bus service cmdlets for Azure Resource Manager in …
3.1.0                Az.ServiceFabric                    PSGallery            Microsoft Azure PowerShell - Service Fabric cmdlets for Azure Resource Manager in Windo…
1.4.1                Az.SignalR                          PSGallery            Microsoft Azure PowerShell - Azure SignalR service commands for Windows PowerShell and …
3.11.0               Az.Sql                              PSGallery            Microsoft Azure PowerShell - SQL service cmdlets for Azure Resource Manager in Windows …
1.1.0                Az.SqlVirtualMachine                PSGallery            Microsoft Azure PowerShell - SqlVirtualMachine service cmdlets for Azure Resource Manag…
1.3.0                Az.StackHCI                         PSGallery            Microsoft Azure PowerShell: StackHci cmdlets
4.8.0                Az.Storage                          PSGallery            Microsoft Azure PowerShell - Storage service data plane and management cmdlets for Azur…
1.7.0                Az.StorageSync                      PSGallery            Microsoft Azure PowerShell - Storage Sync cmdlets in Windows PowerShell and PowerShell …
2.0.0                Az.StreamAnalytics                  PSGallery            Microsoft Azure PowerShell: StreamAnalytics cmdlets
1.0.0                Az.Support                          PSGallery            Microsoft Azure PowerShell - Azure Support cmdlets for Azure Resource Manager in Window…
1.5.0                Az.Synapse                          PSGallery            Microsoft Azure PowerShell - Azure Synapse Analytics in Windows PowerShell and PowerShe…
1.1.0                Az.TrafficManager                   PSGallery            Microsoft Azure PowerShell - Traffic Manager service cmdlets for Azure Resource Manager…
2.11.3               Az.Websites                         PSGallery            Microsoft Azure PowerShell - App Service (Web Apps) service cmdlets for Azure Resource …
2.23.0               Microsoft.Graph                     PSGallery            Microsoft Graph PowerShell module
2.23.0               Microsoft.Graph.Applications        PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Authentication      PSGallery            Microsoft Graph PowerShell Authentication Module.
2.23.0               Microsoft.Graph.BackupRestore       PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Bookings            PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Calendar            PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.ChangeNotifications PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.CloudCommunications PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Compliance          PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.CrossDeviceExperie… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.DeviceManagement    PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.DeviceManagement.A… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.DeviceManagement.A… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.DeviceManagement.E… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.DeviceManagement.F… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Devices.CloudPrint  PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Devices.CorporateM… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Devices.ServiceAnn… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.DirectoryObjects    PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Education           PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Files               PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Groups              PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Identity.Directory… PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Identity.Governance PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Identity.Partner    PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Identity.SignIns    PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Mail                PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Notes               PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.People              PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.PersonalContacts    PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Planner             PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Reports             PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.SchemaExtensions    PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Search              PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Security            PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Sites               PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Teams               PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Users               PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Users.Actions       PSGallery            Microsoft Graph PowerShell Cmdlets
2.23.0               Microsoft.Graph.Users.Functions     PSGallery            Microsoft Graph PowerShell Cmdlets
2.3.0                PnP.PowerShell                      PSGallery            Microsoft 365 Patterns and Practices PowerShell Cmdlets

Regression

No response

Expected behavior

Configure.ps1 should work .

NOTE: I can use 1-WebApp-OIDC\1-1-MyOrg\AppCreationScripts\Configure.ps1 to create apps in my target tenant, so the process works for some of the samples. However the one for 2-3-Multi-Tenant doesn't work.