我正在尝试自动设置从 Azure DevOps 执行的 letEncrypt 所需的服务主体。我正在运行以下代码
Write-Host ("Getting roles for " + $letsEncryptApplication.ApplicationId)
$letsEncryptContributorRole = Get-AzureRmRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $letsEncryptApplication.ApplicationId
if ($letsEncryptContributorRole -eq $null) {
Write-Host "Creating contributor role for lets encrypt service principal"
$letsEncryptContributorRole = New-AzureRmRoleAssignment -RoleDefinitionName Contributor -ServicePrincipalName $letsEncryptApplication.ApplicationId
} else {
Write-Host "Contributor role for lets encrypt service principal already exists"
}
Run Code Online (Sandbox Code Playgroud)
我在 New-AzureRmRoleAssignment 行上收到以下错误
does not have authorization to perform action 'Microsoft.Authorization/roleAssignments/write' over scope '/subscriptions/15ed030e-195f-4fc0-bbb9-cfcf581a1c00'.
Run Code Online (Sandbox Code Playgroud)
我已经通过 Azure DevOps 服务主体的应用程序注册执行此代码,并将我认为与活动目录相关的所有内容都给了它:
我需要授予我的 Azure …
我有一个有条件地创建资源的ARM模板:
{
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_GRS",
"tier": "Standard"
},
"kind": "BlobStorage",
"name": "[variables('storageAccounts_name')]",
"condition": "[equals(parameters('is_Not_Development'), 'True')]",
"apiVersion": "2017-06-01",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
"accessTier": "Hot"
},
"dependsOn": []
},
Run Code Online (Sandbox Code Playgroud)
在我的输出参数中,我有以下内容,如果未创建资源,则会导致错误:
"storageAccountConnectionString": {
"type": "string",
"value": "[Concat('DefaultEndpointsProtocol=https;AccountName=',variables('StorageAccounts_name'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('StorageAccounts_name')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]"
},
Run Code Online (Sandbox Code Playgroud)
我试过这个:
"storageAccountConnectionString": {
"type": "string",
"condition": "[equals(parameters('is_Not_Development'), 'True')]",
"value": "[Concat('DefaultEndpointsProtocol=https;AccountName=',variables('StorageAccounts_name'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('StorageAccounts_name')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value)]"
},
Run Code Online (Sandbox Code Playgroud)
条款条款,但不承认.如何使输出参数有条件?
更新:
我尝试过以下方法:
"storageAccountConnectionString": {
"type": "string",
"value": "[if(equals(parameters('is_Not_Development'),'False'),'null',Concat('DefaultEndpointsProtocol=https;AccountName=',variables('StorageAccounts_name'),';AccountKey=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('StorageAccounts_name')), providers('Microsoft.Storage', 'storageAccounts').apiVersions[0]).keys[0].value))]"
},
Run Code Online (Sandbox Code Playgroud)
但它给了我相同的错误信息,它必须评估真假条件.
这些是在不同版本的 NuGet 包之间迁移的重要指南:
然而,我正在努力在代码中迁移以下概念:
// Return if a directory exists:
container.GetDirectoryReference(path).ListBlobs().Any();
Run Code Online (Sandbox Code Playgroud)
哪里GetDirectoryReference不明白并且似乎没有直接翻译。
此外,a 的概念CloudBlobDirectory似乎并未出现在Azure.Storage.Blobs例如
// Return if a directory exists:
container.GetDirectoryReference(path).ListBlobs().Any();
Run Code Online (Sandbox Code Playgroud)
whereCloudBlobDirectory没有出现在 API 中的任何地方。
我正在运行一个天蓝色管道,如下所示。我在 3 个位置设置了以分钟为单位的超时:作业、池和任务,但是步骤运行验收测试总是在 60 分钟后超时,并显示错误消息:
配置资源时发生错误(错误类型:超时)。操作被取消。
否则,管道中的一切都运行正常。
stages:
- stage: Run_Acceptance_Tests
jobs:
- job: Run_Acceptance_Tests
timeoutInMinutes: 180
pool:
name: Hosted VS2017
timeoutInMinutes: 180
demands:
- msbuild
- visualstudio
- vstest
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(solution)'
msbuildArgs: '/p:SkipInvalidConfigurations=true /p:ExcludeApp_Data=true /p:AutoParameterizationWebConfigConnectionStrings=false /p:MarkWebConfigAssistFilesAsExclude=false /p:ProfileTransformWebConfigEnabled=false /p:TransformWebConfigEnabled=false'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: FileTransform@2
displayName: 'Transform settings for Acceptance tests'
inputs: …Run Code Online (Sandbox Code Playgroud) 我正在尝试运行一个天蓝色的容器实例,但它似乎在我运行它的时候就被杀死了。这在其他 2 个资源组中运行良好,但在我的生产资源组中却不起作用,我在其中看到以下内容:
看了这篇文章,但建议的解决方案不起作用:Azure容器组实例我尝试按照此处的建议放置一个空目录卷和2Gb RAM:https: //github.com/SeleniumHQ/docker-selenium,但什么也没有作品。
这是我用来创建容器的代码:
containerGroup = await azure.ContainerGroups.Define(containerName)
.WithRegion("West Europe")
.WithExistingResourceGroup(configuration.ContainerResourceGroup)
.WithLinux()
.WithPublicImageRegistryOnly()
.WithEmptyDirectoryVolume("devshm")
.DefineContainerInstance(containerName)
.WithImage("selenium/standalone-chrome")
.WithExternalTcpPorts(4444)
.WithVolumeMountSetting("devshm", "/dev/shm")
.WithMemorySizeInGB(2)
.Attach()
.WithDnsPrefix(configuration.AppServiceName + "container")
.WithRestartPolicy(ContainerGroupRestartPolicy.OnFailure)
.CreateAsync(cancellationToken);
Run Code Online (Sandbox Code Playgroud)
我该如何调试出现的问题?容器出了什么问题?
我正在使用 powershell 使用以下脚本创建新的 EC2 密钥对:
Import-Module AWSPowerShell
$Region = "EU West"
$ProfileName = "AWS Default"
Initialize-AWSDefaults -ProfileName $ProfileName
$KeyName = "SecurityEssentials"
$KeyPair = New-EC2KeyPair -KeyName $KeyName
Run Code Online (Sandbox Code Playgroud)
但是它在最后一行失败并显示以下消息:
New-EC2KeyPair:无效的 URI:无法解析主机名。在 C:\Users\John\Documents\Cloud\AWS Setup.ps1:12 char:12 + $KeyPair = New-EC2KeyPair -KeyName $KeyName + ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (Amazon.PowerShe...C2KeyPairCmdlet:NewEC2KeyPairCmdlet) [New-EC2KeyPair], InvalidOperationException +fullyQualifiedErrorId : System.UriFormatException,Amazon.PowerShell.Cmdlets .EC2.NewEC2KeyPairCmdlet
使用调试标志不会提供任何新信息。我正在使用带有最新 AWS SDK 和 AWS powershell cmdlet 的 Windows 8.1
编辑:问题似乎与 AWSDefaults 的设置方式有关。事实证明,在此之后发出的任何命令都会出现相同的错误。
我有visual studio 2017 v2,我正在尝试安装Azure功能扩展.我尝试在新PC和旧PC上进行全新的vs安装.每次收到错误消息"由于无法解决的先决条件而无法将扩展安装到此产品".它没有告诉我它们是什么或我能做些什么来解决问题.我该如何解决这个问题?
我正在尝试使用以下方法直接使用 MQTT 连接到 Azure IoT 中心:
我正在使用适用于 Windows 的 MQTT 资源管理器:https ://mqtt-explorer.com/ 我输入以下详细信息。我的 ioTHub 称为 IoTHub,我的设备称为 device,因此根据文档:
协议:mqtt:// 主机:iothub.azure-devices.net/?api-version=2018-06-3430 端口:8883 验证证书:关闭 加密:关闭 用户名:iothub.azure-devices.net/device/?api -版本=2018-06-30 密码:SharedAccessSignature sr=iothub.azure-devices.net&sig=XXXXXXXXXXXXXXXXXXXredactedXXXXXXXXXXXXXXXXXXXX&se=1642603375&skn=iothubowner
我所在位置没有任何端口被封锁。连接失败并表示已与服务器断开连接。如果我尝试使用 TLS 加密,它会显示未授权。
如何使用 MQTT 访问 IoTHub?
有没有办法在手臂模板中实现这一点?条件在哪里有多个部分?
{
"type": "Microsoft.Web/sites/config",
"name": "[variables('website_notProduction_config')]",
"condition": "[not(parameters('is_Production')) and equals(parameters('is_Not_Development'), 'True')]",
Run Code Online (Sandbox Code Playgroud)