Executing MSBuild with variables in stage returns "project file does not exist"

I have a build process that uses MSBuild to update Azure SQL Managed Instance databases. Essentially, it runs .sql scripts to make these updates. I have successfully ran the commands in PowerShell on a VM. However, when I convert to a pipeline job on a Windows runner, I get the following error in output.

Microsoft (R) Build Engine version 4.8.3761.0 [Microsoft .NET Framework, version 4.0.30319.42000] Copyright (C) Microsoft Corporation. All rights reserved. MSBUILD : error MSB1009: Project file does not exist.

The command I’m trying to run is:

    # example values for these vars and p:ManagedInstanceFQDN, p:SqlDbaOperatorEmail
    - $UserId = "myuserid"
    - $Password = "SomePassword$!@132"
    - $BuildName = "dev"
    - $MsBuildEnvironmentNameParam = "/p:EnvironmentName=$BuildName"

    # Used to establish LOGSA self-referencing Linked Server
    - $MsBuildLinkedServerParams = "/p:ManagedInstanceAdminUserName=$UserId /p:ManagedInstanceAdminPassword=$Password /p:ManagedInstanceFQDN=$($ManagedInstance.FullyQualifiedDomainName)"

    # Used to create SQL Agent Operator
    - $MsBuildSqlAgentParams = "/p:SqlDbaOperatorName=SQLDBA /p:SqlDbaOperatorEmail=$($SqlAgentOperatorEmail)"

    - MSBuild.exe `".\Msbuild\Environments\$BuildName.msbuild`" /t:ConfigureSqlServer /p:EnvironmentName=`"$BuildName`" /p:ManagedInstanceAdminUserName=`"$UserId`" /p:ManagedInstanceAdminPassword=`"$Password`" /p:ManagedInstanceFQDN=`"mysmi.windows.net`" /p:SqlDbaOperatorName=SQLDBA /p:SqlDbaOperatorEmail=`"myemail@mail.com`"
    

In another job, I’m able to execute MSbuild on the same runner without issue, but it does not rely on variables. Here’s an example of a the successful run:

- MSBuild.exe ".\Web Apps\MyApp\MyApp.csproj" /t:Build /p:Configuration=Release /p:DeployOnBuild=true /v:m

I’m thinking it has to do with wrapping quotes around /p: values correctly. I’ve tried several different variations including in addition to the `" above such as '", ", and '. I’ve also tried only wrapping certain values that might be problematic (email, FQDN, and Password). I’ve tried using Invoke-Command and the & operator.

I even tried calling the script I use to execute successfully from a VM with the same results.

What am I missing with this to get it to properly execute in the pipeline?