无法在 Azure devops 的 Azsk 任务中更新策略设置

Can't update policy settings in the Azsk task in Azure devops

在我的 azure devops (vsts) 管道中,我添加了任务 "Azsk"。我不想要 Azsk 团队提供的默认 Pass/Failed 控件,因此我尝试将自定义控件添加到我的任务中。到目前为止这没有用。

我试过了 following tutorial to create a custom control settings but at the step 我有点卡住了。在这里我需要为自定义设置添加一个带有 blob url 的变量,但是教程所说的方式不起作用,所以我通过从 Azure 门户添加一个 blob url 来访问Azsk.json 文件。

在我的 azure devops 管道中,当我尝试部署它时遇到以下错误:

2018-11-13T13:25:41.5141122Z The property 'OnlinePolicyList' cannot be found on this object. Verify that the property exists.
2018-11-13T13:25:41.5141273Z At 
2018-11-13T13:25:41.5141355Z C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Helpers\ConfigurationHelper.ps1:344 
2018-11-13T13:25:41.5141417Z char:7
2018-11-13T13:25:41.5141492Z + ...          if([ConfigurationHelper]::ServerConfigMetadata.OnlinePolicyL ...
2018-11-13T13:25:41.5141593Z +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-11-13T13:25:41.5141654Z     + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException
2018-11-13T13:25:41.5141728Z     + FullyQualifiedErrorId : PropertyNotFoundStrict
2018-11-13T13:25:41.5141775Z  
2018-11-13T13:25:41.5141816Z 
2018-11-13T13:25:41.5141903Z StackTrace: at IsPolicyPresentOnServer, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Helpers\ConfigurationHelper.ps1: line 344
2018-11-13T13:25:41.5142010Z at LoadServerConfigFile, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Helpers\ConfigurationHelper.ps1: line 86
2018-11-13T13:25:41.5142097Z at LoadAzSKSettings, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Models\AzSKSettings.ps1: line 113
2018-11-13T13:25:41.5142197Z at GetInstance, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Models\AzSKSettings.ps1: line 45
2018-11-13T13:25:41.5142296Z at GetAzSKSettings, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Managers\ConfigurationManager.ps1: line 14
2018-11-13T13:25:41.5142403Z at GetAzSKConfigData, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Managers\ConfigurationManager.ps1: line 9
2018-11-13T13:25:41.5142667Z at ValidateOrgPolicyOnSubscription, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Abstracts\CommandBase.ps1: line 340
2018-11-13T13:25:41.5142772Z at CommandBase, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Abstracts\CommandBase.ps1: line 28
2018-11-13T13:25:41.5142858Z at SVTCommandBase, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Abstracts\SVTCommandBase.ps1: line 20
2018-11-13T13:25:41.5142961Z at ServicesSecurityStatus, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\Framework\Core\SVT\ServicesSecurityStatus.ps1: line 5
2018-11-13T13:25:41.5145085Z at Get-AzSKAzureServicesSecurityStatus<Process>, C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\AzSK.7.0\SVT\SVT.ps1: line 211
2018-11-13T13:25:41.5145198Z at <ScriptBlock>, <No file>: line 1
2018-11-13T13:25:41.5145289Z at <ScriptBlock>, D:\a\_tasks\AzSKSVTs_c016cc55-9914-4a9c-b9df-f24d6f9a40f6.0.6\AzSKSVTRuntime.ps1: line 211
2018-11-13T13:25:41.5145402Z at <ScriptBlock>, <No file>: line 1
2018-11-13T13:25:41.5145465Z at <ScriptBlock>, <No file>: line 22
2018-11-13T13:25:41.5145544Z at <ScriptBlock>, <No file>: line 18
2018-11-13T13:25:41.5145605Z at <ScriptBlock>, <No file>: line 1
2018-11-13T13:25:41.7031832Z ##[error]Could not perform AzSK SVTs scan. Please check if task configurations are correct.
2018-11-13T13:25:41.7818512Z ##[error]Unable to perform security scan. Please check task configurations/variables
2018-11-13T13:25:41.9031160Z ##[section]Finishing: AzSK_SVTs 

乍一看,这是模块内部的代码没有获得正确的库。但我现在不知道这与我的自定义控件设置有什么关系。

问题的第二部分:我仍然看不出如何通过这种方式在内部添加自定义控件来自行决定是否让控件通过。 类似于 this。当我在本地电脑上安装模块并更改 controlsettings.json 文件时,这对我有用。但我不知道如何设置或我的管道任务如何在 Azsk 任务中实现它。

是否有人熟悉 Azsk 的任务并且 1) 知道我的错误在说什么。以及 2) 了解如何在 CI/CD 管道中实施自定义扫描设置?

您链接到错误的文件。您的 blob URL 需要指向 ServerConfigMetadata.json,而不是 ControlSettings.json。也就是说,我仍然无法让它工作。

我完全忘记了这个问题。 第一个问题:我的管道中的设置是错误的,因为我的 blob 存储的 link 不完全相同,它们存在一些差异,在我仔细查看并再次遵循教程这一部分的每一步之后(https://github.com/azsk/DevOpsKit-docs/blob/master/07-Customizing-AzSK-for-your-Org/Readme.md#using-cicd-extension-with-custom-org-policy)

第二个问题:我发现如何将一些控件设置为过去,您必须向控件添加证明状态。使控件'notanissue'。在对文档进行一些挖掘之后,这又是一次:https://github.com/azsk/DevOpsKit-docs/tree/master/00c-Addressing-Control-Failures

我要把问题留在这里,因为据我所知,仍有一些人遇到这个问题,我希望我找到的这个解决方案能解决你的问题(问题)

PS:我知道我的回答指的是以后无法访问的link。但由于这是 AzSK 的唯一文档,我的问题的答案是一个完整的教程,我只能提供 links.