There are plugins that set this automatically, like WP Automatic. PAA sites are not different
But if you are doing the whole process by yourself, the best way is through API
There are specific endpoints to upload media
https://developer.wordpress.org/rest-api/reference/media/And then after uploaded you pick the result JSON and use it for the post creation (featured image or whatever)
If the image content are within the post_content then you have to set it on the fly.
Generally in the upload step people first start with the image creation, uploading, retrieving all the image urls and finally setting them where they are supposed to be within the content and send the whole post_content to the post.all at once.