Azure部署错误“订阅未向NRP注册”

bq3bfh9z  于 2023-11-21  发布在  其他
关注(0)|答案(2)|浏览(122)

以前运行az deployment mg create命令来部署带参数的bicep文件时,有人遇到过这个错误吗?我以为它是暂时的,但在我的部署测试期间,它每天都会发生。
也提出了这个问题on GitHub

tvmytwxo

tvmytwxo1#

Microsoft.Network资源提供程序未注册相关订阅。
您可以查看文档以启用它:
注册资源提供程序

jvlzgdj9

jvlzgdj92#

在我的例子中,我在应用蓝图时出错:

There were error(s) encountered during the deployment:
The artifact 'network_deploy_spoke' of type 'Template' failed to deploy due to the following error: Template deployment failed with error [ 
{ "code": "SubscriptionNotRegistered", "message": "Subscription XXX is not registered with NRP." }, 
{ "code": "SubscriptionNotRegistered", "message": "Subscription XXX is not registered with NRP." }, 
{ "code": "SubscriptionNotRegistered", "message": "Subscription XXX is not registered with NRP." }, 
{ "code": "SubscriptionNotRegistered", "message": "Subscription XXX is not registered with NRP." } ]

字符串
因此,正如在文档中提到的,下面使用它来查找和比较NotRegistered提供程序。
Get-AzResourceProvider -ListAvailable | Where-Object RegistrationState -eq "NotRegistered" | Select-Object ProviderNamespace, RegistrationState | Sort-Object ProviderNamespace
然后,我就用下面的方法解决了这个问题:

Register-AzResourceProvider -ProviderNamespace Microsoft.Compute
Register-AzResourceProvider -ProviderNamespace Microsoft.KeyVault 
Register-AzResourceProvider -ProviderNamespace Microsoft.Management
Register-AzResourceProvider -ProviderNamespace Microsoft.RecoveryServices
Register-AzResourceProvider -ProviderNamespace Microsoft.Sql
Register-AzResourceProvider -ProviderNamespace Microsoft.Web

相关问题