I\'ve created a signed .xcarchive file using the xcodebuild command.
Inside the .xcarchive is a .app file. Inside the .app is a file called archived-expanded-entitle
This is indeed a weird behaviour of xcodebuild, but you can still use the exportArchive command and specify the provisioning profile using exportProvisioningProfile:
xcodebuild -exportArchive -exportFormat IPA \
-archivePath /Path/To/Archive/name.xcarchive \
-exportPath /Path/To/Archive/name.ipa \
-exportProvisioningProfile 'PROVISIONING_PROFILE_NAME'
This will reembed the provisioning profile within the app and you won't actually need to speciify the code signing identity again, because the archive should already be signed during the archive process.