I have been trying to get the infrastucture as code analyzed by sonar cloud. As i understood just making sure the checkbox under Azure resource manager should be enough to get the files analyzed. However only the .yml files are shown in the code section of sonarcloud and not the bicep files. What could i be missing here?
Hey there.
Could you provide an example Bicep file that you can reproduce this issue with?
Hi Colin.
Thank you for your response.
I dont think the problem is within the bicep files we have allot of bicep files in the solution non of which show up in sonar cloud analyses
But all are successfully used in the provisioning of azure
And there could still be something specific about these files that would make it useful to have a reproducer!
hmm ok an example file could be like this. I did replace some info with xxx for security reasons
@description('The name of the front door resource')
param frontDoorName string
@description('The base name for the route-specific resources')
param prefix string
@description('The name of the endpoint to be used')
param endpoint string
@description('The front-end domain')
param domainName string
@description('The HTTPS secret name')
param httpsSecretName string
@description('The origin domain name')
param originDomain string
@description('The health check endpoint')
param healthCheckEndpoint string = '/status'
@description('The interval for health checks')
param healthProbeInterval int = 240
resource frontDoorProfile 'xxx' existing = {
name: frontDoorName
}
resource httpsSecret 'xxx' existing = {
parent: frontDoorProfile
name: httpsSecretName
}
resource frontDoorEndpoint 'xxx' = {
name: endpoint
parent: frontDoorProfile
location: 'global'
properties: {
enabledState: 'Enabled'
}
}
resource frontDoorOriginGroup 'xxx' = {
name: '${prefix}-group'
parent: frontDoorProfile
properties: {
loadBalancingSettings: {
sampleSize: 4
successfulSamplesRequired: 3
}
healthProbeSettings: {
probePath: healthCheckEndpoint
probeRequestType: 'GET'
probeProtocol: 'Https'
probeIntervalInSeconds: healthProbeInterval
}
}
}
resource frontDoorOrigin 'xxx' = {
name: '${prefix}-origin'
parent: frontDoorOriginGroup
properties: {
hostName: originDomain
httpPort: 80
httpsPort: 443
originHostHeader: originDomain
priority: 1
weight: 1000
}
}
resource customDomain 'xxx' = {
name: '${prefix}-domain'
parent: frontDoorProfile
properties: {
hostName: domainName
tlsSettings: {
certificateType: 'CustomerCertificate'
secret: {id: httpsSecret.id}
minimumTlsVersion: 'TLS12'
}
}
}
resource frontDoorRoute 'xxx' = {
name: '${prefix}-route'
parent: frontDoorEndpoint
dependsOn: [frontDoorOrigin]
properties: {
originGroup: {
id: frontDoorOriginGroup.id
}
supportedProtocols: ['Http','Https']
httpsRedirect: 'Enabled'
patternsToMatch: ['/*']
forwardingProtocol: 'HttpsOnly'
linkToDefaultDomain: 'Disabled'
customDomains: [{id:customDomain.id}]
}
}
@description('The resource id of the created front door endpoint')
output endpointId string = frontDoorEndpoint.id
@description('The resource id of the custom domain')
output domainId string = customDomain.id
Hi @Robin1,
welcome to the community. Are you trying to analyze the project via AutoScan? We still have an issue with picking .bicep
files with AutoScan. If it is possible for you please try to set up and test a CI-based analysis.
Best,
Nils
Hi Nils,
I was hop;ing to use the AutoScan indeed. Could you share an example pipeline where it is set up with CI-based analysis?
Hey @Robin1
If you go into your project’s Administration > Analysis Method, you should find tutorials for all the relevant CIs.