English 中文(简体)
页: 1 例外:证明书未能从包括的证书中提取一个标语
原标题:Azure KeyVault: Azure.Identity.CredentialUnavailableException: DefaultAzureCredential failed to retrieve a token from the included credentials

我正试图将我的蚊帐核心应用与Keyvault挂钩。 在一个支持身份认同的新 a器上,一切都行得通,但这一申请是在一个不支持身份的经典的斜体上进行的。 我把系统环境变星星星星星号放在了其他可分的网基应用中,关键标志已经使用并且正在完美地运作。

检查我的排外记录,我每次都有以下例外。

Azure.Identity.CredentialUnavailableException: DefaultAzureCredential failed to retrieve a token from the included credentials EnvironmentCredential authentication unavailable. Environment variables are not fully configured ManagedIdentityCredential authentication unavailable, the requested identity has not been assigned to this resource.

我在开始时使用以下法典:

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)               
       .UseApplicationInsights(ConfigurationManager.AppSettings["applicationInsightsInstrumentationKey"])
                .ConfigureKestrel(options => options.AddServerHeader = false)
                .UseIISIntegration()
                .ConfigureAppConfiguration((context, config) =>
                {
                    var vaultName = ConfigurationManager.AppSettings["VaultName"];
                    if (!string.IsNullOrEmpty(vaultName))
                    {
                        var azureServiceTokenProvider = new AzureServiceTokenProvider();
                        var keyVaultClient = new KeyVaultClient(
                            new KeyVaultClient.AuthenticationCallback(
                                azureServiceTokenProvider.KeyVaultTokenCallback));

                        config.AddAzureKeyVault(
                            $"https://{vaultName}.vault.azure.net/",
                            keyVaultClient,
                            new DefaultKeyVaultSecretManager());
                    }
                })
                .UseStartup<Startup>();

网上。 没收下列物品:

   <configSections>
      <section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="false" requirePermission="false"/>
   </configSections>
   <configBuilders>
    <builders>
      <add name="AzureKeyVault" vaultName="<#= this.VaultName #>" type="Microsoft.Configuration.ConfigurationBuilders.AzureKeyVaultConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.Azure, Version=2.0.0.0, Culture=neutral" vaultUri="https://<#= this.VaultName #>.vault.azure.net" />
    </builders>
  </configBuilders>
  <connectionStrings configBuilders="AzureKeyVault">
      <add name="ConnectionString" connectionString="" providerName="System.Data.SqlClient"/>
  </connectionStrings>
最佳回答

您能否证实您正在建立以下系统: 环境变量?

<代码>AZURE_TENANT_ID - id of the Principal Atmospheric Directory tenant

<代码>AZURE_CLIENT_SECRET——服务的主要客户秘密之一

问题回答

如果由于某种原因或您的实际自动取款证书发生变化(例如密码变更),那么演播室视力也会失落。

在这种情况下,只是再次签署,这给我留下了:

在视觉演播室中,投向了各种工具和方案。 扩大“Azure Service Authentication”和“Account Screen” 如果你看到“重入你的全权证书”链接,就点击并再次签字。 如果不是的话,则通过你的视觉演播室形象,尝试一个定期的信号+信号。

”/

In VS 2019 app, for me, one can re-enter the credentials for the VS logged-in user, which has access to the azure resource group.

我采取了以下步骤来解决这个问题。 • 确保你们能有节制的门户网站和必要的资源。

  1. Install Azure Cli
  2. Open PowerShell as admin
  3. Login to azure using az login command
  4. Open visual studio as administrator

这意味着民主选举学会无法从您的建筑环境/设施中找到代表证书。 如果沉积/log化法没有工作,则从您的终点站开始:

>

附上您的全权证书并重新实施该方案。

如果您在当地使用国际数据系统,而不是国际数据系统,重新启用网站 明示,您可能需要根据您的特性管理网站应用群。 缩略语 你的普世律师会不工作。

安装后,再循环备用库。

然后去%windir%System32inetsrvconfigapplicationHost.config

检索<代码>ProfileEnvironment。 如将其编为<代码>false,将其改为true

如果没有,在应用PoolDefaults tag i.e的情况下添加。

<applicationPoolDefaults managedRuntimeVersion="v4.0">
    <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</applicationPoolDefaults>

对我来说,这只是第一个例外,是进一步细分(Continue => 继续=> 继续)。 我最后谈到REAL例外:

az 未被承认为内部或外部指挥

我曾忘记在我的机器上安装了CEL!

一旦我做完,我仍然拿着原始的Credential Un AvailableException,但处理得了(我不敢肯定为什么要打断它,而那是另一个故事)和一切都奏效。

这一SackOverflow链接有助于。

在开发一个网络服务时,国际会计准则协会的东道机构想把申请集合身份放在自己的账户。

我在经过几个小时的尝试后,就把我推向正确方向。

        var credential = new DefaultAzureCredential(
            new DefaultAzureCredentialOptions
            {
                VisualStudioTenantId = "xxx",
                ExcludeVisualStudioCodeCredential = true,
                ExcludeEnvironmentCredential = true,
                ExcludeManagedIdentityCredential = true,
                ExcludeVisualStudioCredential = false,
                ExcludeAzureCliCredential = true,
                ExcludeAzurePowerShellCredential = true,
                ExcludeSharedTokenCacheCredential = true
            });
        var token = credential.GetToken(new Azure.Core.TokenRequestContext(new[] { "https://database.windows.net/.default" }));

视觉演进室 象征性的供应商可在以下网址获得:windowssystem32inetsrv.IdentityserviceAzureserviceAuth okenprovider.json

参考文献 集合身份系统:

对我来说,这是在当地实行的,但我因所部署的网页浏览而遇到这一问题。 该公司在进入KitVault时遇到麻烦。

双重检查主要过失责任:

  • Browse to the web app (in portal.azure.com)
  • Click on the Identity menu item on the left
  • Under the System assigned tab, make sure that status is On
  • Then under the Permission section, click Azure role assignments
  • Choose subscription, then select the resource, and "Key Vault Secrets User" or similar as the role, and fill out the rest.

Restart the web app or browse this in App Service Editor console to establish that the problem is addressed. 希望能帮助人们!

In my situation, Visual Studio logged in to Azure was not enough, though from Microsoft documentation it sounds like an option. I had to install Azure CLI on my Windows 11, and it still did not work to me until I rebooted my Windows

我意外地补充说,我用用户名和pw来形容积极的直系词,这时我需要使用用户名。

我得以通过安装“Azure> CLI工具”的延伸和通过VS代码终端重新安装的标志来消除这一错误,请在以下网址上查到更多细节:https://ojuliuscoder.medium.com/installing-and-using-azure-cli-in-udio-code-a382d2b09bfa#:%7E:text=After%20appen%20our%20VSCode%2C%20we,tool%20inthe%20extension%20tabs%20Inpre%20Cools%20Int%20ID%20





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签