算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
devops-azure【设计与创意】Trigger: "Azure", "Microsoft Azure", "Azure DevOps", "Azure Kubernetes", "AKS", "Azure Functions", "Azure App Service", "Azure Storage", "Azure SQL", "ARM template", "Bicep", "Azure CLI", "Azure pipeline", "Azure AD", "Managed Identity", "Azure Policy", "Azure Monitor", "Log Analytics", "Key Vault", "Azure Front Door", "Azure Firewall", "Private Link…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Provision and operate Azure infrastructure using Bicep, AKS, Azure DevOps pipelines, and Azure-native networking with landing zone design, security, and cost optimization.
Any user message referencing Azure services, AKS, Bicep, ARM templates, Azure DevOps pipelines, Azure AD, or Azure networking.
Azure service required, region, resource naming convention, cost tier, compliance requirements, existing resource group structure, management group hierarchy.
Bicep/ARM templates, Azure DevOps YAML pipeline definitions, AKS cluster config, networking architecture, Azure Policy definitions.
Bicep/ARM JSON/YAML with inline explanations. Azure CLI commands where applicable.
No preamble. No postamble. No explanations. No filler/hedging/transitions.
Infrastructure deployed via Bicep, AKS cluster operational, pipeline passing, networking secured with private endpoints and NSG rules, cost budgets active.
8000 tokens.
| Workload Type | Recommended | Key Factor | Scaling |
|---|---|---|---|
| Kubernetes workloads | AKS | Need K8s ecosystem | Node pools + HPA |
| Web app, simple | App Service | PaaS, deployment slots | Auto-scale |
| Event-driven, short | Azure Functions | <10min execution | Consumption plan |
| Container, simple | Container Instances | Quick, burst | Manual |
| Full OS control | Virtual Machines | Legacy, custom OS | VMSS |
| Requirement | Recommended | HA Model |
|---|---|---|
| SQL Server compatible, <4TB | Azure SQL Database (DTU) | Active geo-replication |
| SQL Server compatible, >4TB | Azure SQL Database (vCore) | Zone-redundant |
| SQL Server, full instance | SQL Managed Instance | Auto-failover groups |
| NoSQL, multi-model | Cosmos DB | Multi-region writes |
| PostgreSQL/MySQL | Azure Database for PostgreSQL | Read replicas |
| Cache | Azure Cache for Redis | Premium with clustering |
| Scenario | Recommended | Monthly Cost Est. |
|---|---|---|
| Single region, <10 spokes | Hub-spoke VNet | $0 (peering: $0.01/GB) |
| Multi-region, >10 spokes | Virtual WAN | ~$300/hr (hub) |
| Global web app, WAF | Front Door + WAF | ~$330/month + data |
| Site-to-site VPN | VPN Gateway | ~$30/month |
| Dedicated private connection | ExpressRoute | ~$500/month + port fees |
| Method | Use Case | Security Level |
|---|---|---|
| Azure AD user | Human access, Azure Portal | Medium (requires MFA) |
| Managed Identity | Azure resource to Azure resource | High (no credentials) |
| Service Principal | External app, CI/CD | Medium (secret rotation needed) |
| Azure AD Pod Identity | Pods to Azure services (AKS) | High |
| Workload Identity Federation | GitHub Actions, Terraform Cloud | High (OIDC, no secrets) |
Management group hierarchy → Bicep template for VNet hub-spoke → AKS cluster + Azure AD integration → Azure DevOps pipeline → Private Link for PaaS → Azure Policy for governance → Monitor with Log Analytics → Cost budgets + tags.
// management-groups.bicep
targetScope = 'tenant'
resource mgRoot 'Microsoft.Management/managementGroups@2023-04-01' = {
name: take(format('{0}', subscription().tenantId), 64)
properties: {
displayName: 'Tenant Root Group'
}
}
resource mgPlatform 'Microsoft.Management/managementGroups@2023-04-01' = {
name: 'platform'
properties: {
displayName: 'Platform'
parent: {
id: mgRoot.id
}
}
}
resource mgLandingZones 'Microsoft.Management/managementGroups@2023-04-01' = {
name: 'landing-zones'
properties: {
displayName: 'Landing Zones'
parent: {
id: mgRoot.id
}
}
}
resource mgSandbox 'Microsoft.Management/managementGroups@2023-04-01' = {
name: 'sandbox'
properties: {
displayName: 'Sandbox'
parent: {
id: mgRoot.id
}
}
}
// Subscriptions
resource platformSub 'Microsoft.Subscription/aliases@2021-10-01' = {
name: 'platform-sub'
properties: {
displayName: 'Platform Subscription'
billingScope: '/providers/Microsoft.Billing/billingAccounts/...'
workload: 'Production'
}
}
// networking/hub-spoke.bicep
param location string = resourceGroup().location
param hubVnetAddressPrefix string = '10.0.0.0/16'
param spokeVnetAddressPrefix string = '10.1.0.0/16'
resource hubVnet 'Microsoft.Network/virtualNetworks@2023-11-01' = {
name: 'hub-vnet-${location}'
location: location
properties: {
addressSpace: {
addressPrefixes: [hubVnetAddressPrefix]
}
subnets: [
{
name: 'GatewaySubnet'
properties: {
addressPrefix: '10.0.0.0/27'
}
}
{
name: 'AzureFirewallSubnet'
properties: {
addressPrefix: '10.0.0.64/26'
}
}
{
name: 'shared-services'
properties: {
addressPrefix: '10.0.1.0/24'
networkSecurityGroup: { id: nsgShared.id }
}
}
]
}
}
resource spokeVnet 'Microsoft.Network/virtualNetworks@2023-11-01' = {
name: 'spoke-vnet-${location}-${spokeName}'
location: location
properties: {
addressSpace: {
addressPrefixes: [spokeVnetAddressPrefix]
}
subnets: [
{
name: 'workload'
properties: {
addressPrefix: '10.1.0.0/24'
delegations: []
privateEndpointNetworkPolicies: 'Disabled'
}
}
]
}
}
resource vnetPeering 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2023-11-01' = {
name: 'hub-to-spoke-${spokeName}'
parent: hubVnet
properties: {
allowVirtualNetworkAccess: true
allowForwardedTraffic: true
allowGatewayTransit: true
useRemoteGateways: false
remoteVirtualNetwork: { id: spokeVnet.id }
}
}
resource vnetPeeringReverse 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2023-11-01' = {
name: 'spoke-to-hub-${spokeName}'
parent: spokeVnet
properties: {
allowVirtualNetworkAccess: true
allowForwardedTraffic: true
allowGatewayTransit: false
useRemoteGateways: true
remoteVirtualNetwork: { id: hubVnet.id }
}
}
resource nsgShared 'Microsoft.Network/networkSecurityGroups@2023-11-01' = {
name: 'nsg-shared-services'
location: location
properties: {
securityRules: [
{
name: 'AllowHTTP'
properties: {
protocol: 'Tcp'
sourcePortRange: '*'
destinationPortRange: '80'
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
access: 'Allow'
priority: 100
direction: 'Inbound'
}
}
{
name: 'DenyAllInbound'
properties: {
protocol: '*'
sourcePortRange: '*'
destinationPortRange: '*'
sourceAddressPrefix: '*'
destinationAddressPrefix: '*'
access: 'Deny'
priority: 4000
direction: 'Inbound'
}
}
]
}
}
// aks/aks-cluster.bicep
param clusterName string = 'aks-production'
param dnsPrefix string = 'aks-production-dns'
param kubernetesVersion string = '1.29'
param vmSize string = 'Standard_DS3_v2'
param nodeCount int = 3
resource aksCluster 'Microsoft.ContainerService/managedClusters@2024-01-01' = {
name: clusterName
location: resourceGroup().location
identity: {
type: 'SystemAssigned'
}
properties: {
kubernetesVersion: kubernetesVersion
dnsPrefix: dnsPrefix
enableRBAC: true
aadProfile: {
managed: true
enableAzureRBAC: true
adminGroupObjectIDs: ['00000000-0000-0000-0000-000000000000']
}
networkProfile: {
networkPlugin: 'azure'
networkPolicy: 'calico'
loadBalancerSku: 'standard'
serviceCidr: '10.0.0.0/16'
dnsServiceIP: '10.0.0.10'
dockerBridgeCidr: '172.17.0.1/16'
}
agentPoolProfiles: [
{
name: 'system'
count: 2
vmSize: 'Standard_DS2_v2'
osType: 'Linux'
mode: 'System'
type: 'VirtualMachineScaleSets'
enableAutoScaling: true
minCount: 2
maxCount: 5
availabilityZones: ['1', '2', '3']
}
{
name: 'user'
count: nodeCount
vmSize: vmSize
osType: 'Linux'
mode: 'User'
type: 'VirtualMachineScaleSets'
enableAutoScaling: true
minCount: 3
maxCount: 20
availabilityZones: ['1', '2', '3']
nodeTaints: []
}
]
disableLocalAccounts: true
oidcIssuerProfile: {
enabled: true
}
workloadIdentityProfile: {
enabled: true
}
azureMonitorProfile: {
metrics: {
enabled: true
}
}
securityProfile: {
defender: {
securityMonitoring: {
enabled: true
}
}
imageCleaner: {
enabled: true
intervalHours: 24
}
}
autoUpgradeProfile: {
upgradeChannel: 'stable'
}
nodeResourceGroup: 'MC_${clusterName}'
}
}
# azure-pipelines.yml
trigger:
branches:
include:
- main
- develop
variables:
- group: 'production-secrets'
- name: dockerRegistryServiceConnection
value: 'acr-connection'
- name: imageRepository
value: 'myapp'
- name: containerRegistry
value: 'myacr.azurecr.io'
- name: tag
value: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build and Push
jobs:
- job: Build
pool:
vmImage: 'ubuntu-latest'
steps:
- task: Docker@2
displayName: Build and Push
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: 'Dockerfile'
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
latest
- task: PublishPipelineArtifact@1
inputs:
targetPath: 'kubernetes/'
artifact: 'manifests'
- stage: DeployDev
displayName: Deploy to Dev
dependsOn: Build
condition: succeeded()
variables:
- group: 'dev-environment'
jobs:
- deployment: Deploy
pool:
vmImage: 'ubuntu-latest'
environment: 'dev'
strategy:
blueGreen:
deploy:
steps:
- task: KubernetesManifest@1
inputs:
action: deploy
connectionType: kubernetesServiceConnection
kubernetesServiceConnection: 'aks-dev'
namespace: 'myapp'
manifests: '$(Pipeline.Workspace)/manifests/**/*.yaml'
containers: '$(containerRegistry)/$(imageRepository):$(tag)'
- stage: DeployProd
displayName: Deploy to Production
dependsOn: DeployDev
condition: succeeded()
variables:
- group: 'prod-environment'
jobs:
- deployment: Deploy
pool:
vmImage: 'ubuntu-latest'
environment: 'production'
strategy:
canary:
increments: [10, 50, 100]
deploy:
steps:
- task: KubernetesManifest@1
inputs:
action: deploy
connectionType: kubernetesServiceConnection
kubernetesServiceConnection: 'aks-prod'
namespace: 'myapp'
manifests: '$(Pipeline.Workspace)/manifests/**/*.yaml'
containers: '$(containerRegistry)/$(imageRepository):$(tag)'
// networking/private-link.bicep
param storageAccountName string
param sqlServerName string
resource privateEndpointStorage 'Microsoft.Network/privateEndpoints@2023-11-01' = {
name: 'pe-${storageAccountName}-blob'
location: resourceGroup().location
properties: {
subnet: {
id: spokeSubnet.id
}
privateLinkServiceConnections: [
{
name: 'storage-blob'
properties: {
privateLinkServiceId: storageAccount.id
groupIds: ['blob']
}
}
]
privateDnsZoneGroup: {
name: 'default'
properties: {
privateDnsZoneConfigs: [
{
name: 'privatelink-blob-core-windows-net'
properties: {
privateDnsZoneId: dnsZoneBlob.id
}
}
]
}
}
}
}
resource privateEndpointSql 'Microsoft.Network/privateEndpoints@2023-11-01' = {
name: 'pe-${sqlServerName}'
location: resourceGroup().location
properties: {
subnet: {
id: spokeSubnet.id
}
privateLinkServiceConnections: [
{
name: 'sql-server'
properties: {
privateLinkServiceId: sqlServer.id
groupIds: ['sqlServer']
}
}
]
}
}
// governance/azure-policy.bicep
resource policyAssignmentTags 'Microsoft.Authorization/policyAssignments@2023-04-01' = {
name: 'require-cost-center-tag'
properties: {
displayName: 'Require Cost Center Tag'
description: 'Enforces presence of costCenter tag on all resources'
policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/...'
parameters: {
tagName: {
value: 'costCenter'
}
}
enforcementMode: 'Default'
}
}
resource policyAssignmentLocations 'Microsoft.Authorization/policyAssignments@2023-04-01' = {
name: 'allowed-locations'
properties: {
displayName: 'Allow only East US and West Europe'
policyDefinitionId: '/providers/Microsoft.Authorization/policyDefinitions/e56962a6-4747-49cd-b67b-bf8b01975c4c'
parameters: {
listOfAllowedLocations: {
value: ['eastus', 'westeurope']
}
}
}
}
| Category | Azure | AWS |
|---|---|---|
| Compute - VMs | Virtual Machines | EC2 |
| Compute - Containers | AKS | EKS |
| Compute - Serverless | Azure Functions | Lambda |
| Compute - PaaS Web | App Service | Elastic Beanstalk |
| Storage - Object | Blob Storage | S3 |
| Storage - Block | Disk Storage | EBS |
| Storage - File | Azure Files | EFS |
| Database - SQL | Azure SQL Database | RDS |
| Database - NoSQL | Cosmos DB | DynamoDB |
| Networking - VNet | Virtual Network | VPC |
| Networking - LB | Azure Load Balancer | ELB/ALB |
| Networking - CDN | Azure Front Door / CDN | CloudFront |
| DNS | Azure DNS | Route53 |
| IAM | Azure AD + RBAC | IAM |
| Key Management | Key Vault | KMS |
| Monitoring | Azure Monitor | CloudWatch |
| CI/CD | Azure DevOps Pipelines | CodePipeline |
| IaC | Bicep/ARM | CloudFormation/CDK |
| Governance | Azure Policy | AWS Config |
Putting all subscriptions flat at root level. Use at least 3 levels: Platform, Landing Zones, Sandbox — enables policy inheritance and cost separation.
Using public endpoints for Azure SQL, Storage, ACR instead of Private Link. This exposes services to the internet and bypasses VNet security controls.
Using a single service principal across environments. Each environment gets its own managed identity or service principal with scoped permissions.
Writing raw ARM JSON when Bicep provides cleaner syntax, modules, and linting. Bicep compiles to ARM and is the recommended IaC tool.
Not applying resource locks (CanNotDelete / ReadOnly) to production resources. Accidental deletion of resource groups can wipe production infrastructure.
No budgets, no alerts, no tags for cost allocation. Azure costs can spiral without governance. Set budgets at 50/80/100% with action groups.
| Issue | Likely Cause | Solution |
|---|---|---|
| AKS node provisioning fails | Quota limit in region | Request vCPU quota increase |
| Private Link connection timeout | Private DNS not configured | Verify Private DNS Zone linked to VNet |
| Azure DevOps pipeline fails | Service Principal expired | Rotate SP secret or use Workload Identity |
| Bicep deployment fails | Module not found | Verify module registry path and version |
| Azure Policy non-compliant | Resource missing required tag | Add tags; check policy definition |
| Key Vault access denied | Missing access policy | Add service principal/managed identity to KV |
Bicep/ARM templates, Azure DevOps YAML pipeline definitions, AKS config, Azure CLI commands.
Hand off to Azure when provisioning Azure-specific infrastructure or pipelines. Hand off to terraform for multi-cloud IaC. Hand off to monitoring for Azure Monitor configuration.