Reputation: 1650
Our ASP.NET Web Api project has two deployment configurations (.pubxml):
The Web deployment (1) works just fine. The Package deployment to a zip is failing with the following errors:
Warning 3 No element in the source document matches '/configuration/system.identityModel' 20 10 MyWebProject
Error 4 No element in the source document matches '/configuration/system.identityModel/identityConfiguration' 21 10 MyWebProject
Looking at the verbose logs, I can see it's failing during the Web.config transform.
ParameterizeTransformXml: No element in the source document matches '/configuration/appSettings/add[@key='ida:AudienceUri']'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 7, 9)
ParameterizeTransformXml: No element in the source document matches '/configuration/appSettings/add[@key='ida:Realm']'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 10, 9)
ParameterizeTransformXml: No element in the source document matches '/configuration/appSettings/add[@key='ida:FederationMetadataLocation']'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 13, 9)
Warning : No element in the source document matches '/configuration/system.identityModel'
ParameterizeTransformXml: Not executing RemoveAll (transform line 24, 14)
Error : No element in the source document matches '/configuration/system.identityModel/identityConfiguration'
ParameterizeTransformXml: Not executing Insert (transform line 27, 9)
ParameterizeTransformXml: No element in the source document matches '/configuration/system.identityModel'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 33, 9)
ParameterizeTransformXml: No element in the source document matches '/configuration/system.identityModel.services'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 42, 9)
ParameterizeTransformXml: No element in the source document matches '/configuration/system.identityModel.services'
ParameterizeTransformXml: Not executing SetTokenizedAttributes (transform line 45, 9)
ParameterizeTransformXml: Transformation failed
Done executing task "ParameterizeTransformXml" -- FAILED.
Done building target "_TransformWebConfigForAzureAuthenticationCore" in project "MyWebProject.csproj" -- FAILED.
Done building project "MyWebProject.csproj" -- FAILED.
What additional build information do I need to configure to get the Zip deployment past these errors? It works just fine if I do a direct web deployment.
Upvotes: 13
Views: 6496
Reputation: 718
I know this is pretty old, but I just had this problem and the only thing that solved it for me was to re-download the publish profile from the Azure Web App Overview blade's "Get Publish Profile" button. Then I had to import it into the solution.
Hope that helps someone!
Upvotes: 0
Reputation: 21
I added the below configuration explicitly:
<system.identityModel>
<identityConfiguration>
<audienceUris>
</audienceUris>
</identityConfiguration>
</system.identityModel>
It is able to create the package finally!
Upvotes: 2
Reputation: 1842
If you are using the publish wizard, make sure that "Enable Organizational Authentication" is unchecked**. This fixed it for me.
Upvotes: 3
Reputation: 27944
You are missing the system.identityModel elements in your configuration for AD integration. If you want to integrate with the azure AD, you need to enable Windows Identity Foundation (WIF) options in your configuration.
<configuration>
<configSections>
<!--WIF 4.5 sections -->
<section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</configSections>
...
<system.identityModel>
<identityConfiguration>
<audienceUris>
<add value="http://localhost/WebApplication1/" />
</audienceUris>
<issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
<trustedIssuers>
<add thumbprint="313D3B … 9106A9EC" name="SelfSTS" />
</trustedIssuers>
</issuerNameRegistry>
<certificateValidation certificateValidationMode="None"/>
</identityConfiguration>
</system.identityModel>
...
</configuration>
Upvotes: 0
Reputation: 301
Check your publish settings to see if you have EnableADPublish set to true. That was my problem (I was configuring Azure AD Auth through other means), so I just set it to false and everything worked great.
<EnableADPublish>false</EnableADPublish>
Cheers, Jeff
Upvotes: 27