我的 Azure Web API 加载在 Key Vault 中存储为机密的证书,然后尝试从字节数组创建新证书。在本地运行一切正常,但是,当部署到 Azure 时,我们会收到拒绝访问或系统找不到根据传递给构造函数的 KeyStorageFlags指定的文件。Web API 使用 .Net Core 2.2
我已经在这方面阅读了大量与此相关的信息,但不是这个特定场景。
使用 MachineKeySet 标志:
certificate = new X509Certificate2(pfxBytes, "",
X509KeyStorageFlags.MachineKeySet |
X509KeyStorageFlags.Exportable);
例外
ex=Access denied, stack= at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore(Byte[] rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags) at Internal.Cryptography.Pal.CertificatePal.FromBlobOrFile(Byte[] rawData, String fileName, SafePasswordHandle password , X509KeyStorageFlags keyStorageFlags) 在 System.Security.Cryptography.X509Certificates.X509Certificate..ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags)
使用 UserKeySet 标志:
certificate = new X509Certificate2(pfxBytes, "",
X509KeyStorageFlags.UserKeySet |
X509KeyStorageFlags.Exportable);
例外
ex=系统找不到指定的文件,stack= at Internal.Cryptography.Pal.CertificatePal.FilterPFXStore(Byte[] rawData, …
我正在使用 Windows 10、Azure PowerShell Az 模块、DevOps 扩展 0.18.0
我已登录 DevOps 实例并能够运行所有相关命令。现在,我需要登录到不同的组织/项目。每次执行登录子命令时,窗口都会挂起并锁定,我必须重新启动 PowerShell ISE 才能重试。
我正在使用的命令(我已经尝试了几种变体)是:
> az login
> $env:AZURE_DEVOPS_EXT_PAT ='{PAT}'
> az devops login --organization https://dev.azure.com/{org} --debug
Run Code Online (Sandbox Code Playgroud)
挂在这里!
调试日志如下
az devops login --organization https://dev.azure.com/{org} --debug
Run Code Online (Sandbox Code Playgroud)CategoryInfo : NotSpecified: (Command argumen...nn', '--debug']:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError Event: Cli.PreExecute [] Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x03A171E0>, <function OutputProducer.on_global_arguments at 0x03B3AA98>, <function CLIQuery.on_global_arguments at 0x03B5CCD8>] Event: CommandInvoker.OnPreCommandTableCreate [] Modules found from index for 'devops': ['azext_devops'] Loading command modules: Name Load …
我有一个 Azure Redis 和 .Net Core 2 的工作实现,使用的代码与本文中描述的非常相似
我的问题是,如何从单元测试类实例化缓存的实例?我查看了许多资源,但一无所获。
我需要能够创建一个实例来实例化一个类,例如
public CacheManager(IDataManager dataservices, IDistributedCache cache)
{
_cache = cache;
_dataservices = dataservices;
}
Run Code Online (Sandbox Code Playgroud)
startup.cs 中的代码使用了 ConfigureServices
//Configure Redis Cache
var redisconnection = Configuration.GetConnectionString("Redis");
services.AddDistributedRedisCache(o => { o.Configuration = redisconnection; });
Run Code Online (Sandbox Code Playgroud)
也许我需要向单元测试项目添加一个包?这是怎么做的?
使用 Azure CLI 2.x,我找不到在 Azure AD 门户中公开 API 部分下“添加范围”的方法。
我所看到的是,如果我在创建应用程序时传递 --identifier-uris,则会自动设置 APP ID URI 和 Scope:
`az ad app create --display-name "$appName" --identifier-uris "https://$tenantDomain/$appName" --reply-urls "$replyUrl" --oauth2-allow-implicit-flow true`
Run Code Online (Sandbox Code Playgroud)
不是我所期望的,也不是我想要的
因此,我从 create 命令中删除了 --identifier-urls 并手动添加了我想要的范围。然后我通过清单看到我在 OAuth2Permissions 下寻找的内容,如下所示。我可以用新的 guid 将它放在 manifest.json 中并以某种方式插入吗?
什么 CLI 命令支持明确支持定义范围?然后添加一个客户端应用程序我需要选择定义的范围,这是如何引用的?
IMO,文档非常稀少。这个参考非常有用,但这里没有讨论添加范围和客户端。https://docs.microsoft.com/en-us/cli/azure/ad?view=azure-cli-latest。非常感谢对示例或文档的任何帮助。
azure azure-active-directory azure-cli2 azure-ad-powershell-v2