How to assign blocks to particular regions on theme install? Drupal 8 provides some blocks by default. Eg. Site Branding, Main Navigation, Powered by Drupal, Search etc.

I have created a theme that has Site branding &amp; Main Navigation named regions in which corresponding blocks can be placed.

When I enable my theme, Site Branding &amp; Main Navigation blocks are placed in Header &amp; First Sidebar region of my theme by default respectively.

How can I place Site Branding &amp; Main Navigation blocks to their respective regions by default on theme install?
First of all, you should change each desired block region you want manually at Administration&gt;Structure&gt;Block layout Tab and then go to the config export function at:
Administration&gt;Configuration&gt;Development&gt;Configuration synchronization&gt;Export Tab&gt;Single item to export each the block settings for your theme.
Then you should take a look at to the generated YAML files and placed that in a new folder within your theme at /config/install. you then uninstalled the theme and then reinstalled it as the default.

Summary:
1. Install MY_THEME
2. Place the blocks in the desired regions
3. Export config files and remove from them uuid and core config hash
for example Site Branding block block.block.MY_THEME_branding.yml file

langcode: en
status: true
dependencies:
  module:
    - system
  theme:
    - DEPENDENT_THEME
id: MY_THEME_branding
theme: MY_THEME
region: site_branding
weight: 0
provider: null
plugin: system_branding_block
settings:
  id: system_branding_block
  label: 'Site branding'
  provider: system
  label_display: '0'
  use_site_logo: true
  use_site_name: true
  use_site_slogan: true
visibility: {  }



Place config files to MY_THEME/config/optional or MY_THEME/config/install directory (if you're absolutely sure all dependencies are met)
Uninstall MY_THEME and clear all caches
Reinstall MY_THEME again