# Azure AD Admin needs to be imported into state when deploying Azure PostgreSQL server with geo-restore

**URL:** <https://discuss.hashicorp.com/t/azure-ad-admin-needs-to-be-imported-into-state-when-deploying-azure-postgresql-server-with-geo-restore/28146>\
**Category:** Azure\
**Created:** [August 12, 2021, 1:27pm UTC](https://discuss.hashicorp.com/t/azure-ad-admin-needs-to-be-imported-into-state-when-deploying-azure-postgresql-server-with-geo-restore/28146 "2021-08-12T13:27:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael3](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/michael3/32/16380_2.png) [@michael3](https://discuss.hashicorp.com/u/michael3)\
**Post date:** [August 12, 2021, 1:27pm UTC](https://discuss.hashicorp.com/t/azure-ad-admin-needs-to-be-imported-into-state-when-deploying-azure-postgresql-server-with-geo-restore/28146/1 "2021-08-12T13:27:52Z")

</div>

When deploying a resource `azurerm_postgresql_server` with `create_mode` set to `GeoRestore` Azure will assign the same Azure AD Admin to the target server, as was assigned to the source server. This causes deployment to fail when trying to assign `azurerm_postgresql_active_directory_administrator` to the target server because Terraform tries to create the Azure AD admin because Terraform thinks the AAD Admin is not configured on the target server, but Azure created it while restoring from backup.

Terraform needs to support importing the `azurerm_postgresql_active_directory_administrator` resource automatically when performing geo-restore deployment.
