Template: microservice
Template Type: Classic
Created ABP Studio Version: 1.0.2
Current ABP Studio Version: 3.0.6
Multi-Tenancy: Yes
UI Framework: mvc
Theme: leptonx
Theme Style: system
Theme Menu Placement: side
Database Provider: ef
Database Management System: sqlserver
Mobile Framework: none
Public Website: No
Social Login: Yes
Include Tests: Yes
Dynamic Localization: Yes
Kubernetes Configuration: Yes
Grafana Dashboard: Yes
Use Local References: No
Optional Modules:
- GDPR
- TextTemplateManagement
- AuditLogging
- OpenIddictAdmin
Selected Languages: English, English (United Kingdom), Español
Default Language: English
Create Command: abp new CloverleafCMS -t microservice --ui-framework mvc --database-provider ef --database-management-system sqlserver --theme leptonx --skip-migrator --without-cms-kit --dont-run-bundling -no-file-management -no-language-management
Exception message and full stack trace: Permission groups, permissions and admin permission grants not created when running the solution on AKS
Steps to reproduce the issue:
- Created a new micro-service using Abp studio, added an entity then ran the solution on localhost. When I checked the Administration Service database permissions tables the new micro-service permissions were there.
- When I deployed the new micro-service in AKS and checked the Administration Service database permissions tables the new micro-service permissions were not there.
- I uninstalled the helm charts, cleared the Redis cache then reinstalled the helm charts. When I checked the Administration Service database permissions tables the new micro-service permissions were **still not **there.
Note: we use different database servers and databases for running the solution on localhost and AKS.
2 Answer(s)
-
0
In the microservice template, permission groups/permissions are written into the Administration Service database by the microservice itself when that microservice starts (via
PermissionManagementOptions.SaveStaticPermissionsToDatabase, which istrueby default). So if the new microservice runs in AKS but its permission definitions are not appearing inAbpPermissionGroups/AbpPermissions, it means that microservice did not successfully execute the “save static permissions to DB” step in AKS (even if it worked locally).Separately: granting new permissions to the
adminrole is not done by every microservice. Only Administration Service seeds/grants newly discovered permissions to theadminrole. So even after the permissions exist inAbpPermissions, you may still not seeAbpPermissionGrantsforadminuntil Administration Service runs/restarts.
What to do (AKS / Helm)
Restart the new microservice pods (not only Administration)
Permission definitions are persisted on microservice startup. After deploying a new microservice or adding new permissions, you must restart that microservice so it re-registers permissions into the Administration DB.Restart the Administration Service after the microservice has registered permissions
Administration seeds/grants the missing permissions toadminwhen it starts. So do a rollout restart of Administration after the new microservice has come up successfully.Verify
PermissionManagementOptions.SaveStaticPermissionsToDatabaseis not disabled in AKS configuration
In Kubernetes, it’s common to have environment-specificappsettings.Production.json(or Helm values) that differ from local. Ensure you didn’t override this option (directly or indirectly) tofalsein AKS.Check the new microservice logs in AKS during startup
If it cannot reach the Administration database (connection string / firewall / DNS / TLS), or if it crashes before initialization completes, permissions won’t be saved. This is the most common cause when “works on localhost but not in AKS”, especially since you’re using different DB servers.(If you also don’t see the permissions in the UI) Clear the distributed cache used by AKS Even after the DB rows exist, permission definition data is cached. If AKS uses a different Redis instance than local, you must clear that Redis (or restart services) to invalidate cached permission definitions.
(Optional) If you want automatic granting to
adminwithout relying on Administration restartAdd a data seeder in the relevant microservice and call
IPermissionDataSeederto grant permissions toadmin(ABP’s docs mention this approach and Identity service uses it).
Source (validated):
- https://abp.io/docs/latest/solution-templates/microservice/permission-management
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
In the microservice solution, each microservice writes its own permission definitions into the Administration database when it starts, using the
AdministrationServiceconnection string. This runs in a background task: if saving fails, the service still completes startup and keeps serving requests, and the failure only shows up in its logs. Clearing Redis doesn't help here because the cache is not what writes these rows.Since it works on localhost but not in AKS, check two things for the new microservice:
The effective environment of the running pod (
kubectl describe podorkubectl exec ... env):ConnectionStrings__AdministrationServicemust point to the Administration database used in AKS. The built-in services all get it from their helm charts (etc/k8s/.../charts/<service>/templates/<service>-deployment.yaml). If the new service's chart doesn't set it, the pod uses theappsettings.jsonvalue baked into the image (localhost), which is not reachable inside the cluster.The new microservice pod's logs, from startup onwards - search for errors from
Volo.Abp.PermissionManagementand SQL connection errors. Note the save is retried with increasing delays for about an hour after startup, so check the full log, not just the first minutes.
After fixing the connection string, restart the new microservice pods so the permission definitions are saved, then restart the Administration service - its startup seeder grants the new permissions to the
adminrole.If both look fine, share the logs with us (you can send them to liming.ma@volosoft.com if they're too large for the thread) and we'll dig further.
Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)