How do I render a block programmatically with the standard template? I'm using the following code to render a set of blocks programmatically:

$region_content = [];
$block_manager = \Drupal::service('plugin.manager.block');
$blocks = $this-&gt;getBlocks();
foreach ($blocks[$region_name] as $key=&gt;$block_config) {
  $instance = $block_manager-&gt;createInstance($block_config['plugin_id'], $block_config['config']);
  $region_content[] = [
    $instance-&gt;build();
  ];
}


The contents of $block_config['config'] look like this:

[
  'provider' =&gt; 'search',
  'admin_label' =&gt; '',
  'label' =&gt; 'Search form',
  'label_display' =&gt; TRUE,
  'third_party_settings' =&gt; [
    'block_aria_landmark_roles' =&gt; [
      'role' =&gt; '',
    ],
  ],
]


The resulting $instance object seems to work correctly, and when I render $region_content I do indeed get the contents of the blocks as expected. But they are not wrapped in the block template. I thought I might have to do something like this:

$region_content[] = [
  '#theme' =&gt; 'block',
  'contents' =&gt; $instance-&gt;build(),
];


...but that doesn't work at all. How do I take this $instance object and render it using the standard block template? Or am I completely off course here?
If you want to render blocks directly from twig you can use:

Twig tweak 8.x-1.9 https://www.drupal.org/project/twig_tweak

You just need to install it.
The block should be configured on "admin/structure/block" page.
Example how to use:
 &lt;dt&gt;Block:&lt;/dt&gt;
  &lt;dd&gt;{{ drupal_block('system_powered_by_block') }}&lt;/dd&gt;

Add this code directly in the twig template file.