@@ -3,6 +3,7 @@ package azure
33import (
44 "context"
55
6+ "github.com/Azure/azure-sdk-for-go/profiles/latest/resources/mgmt/subscriptions"
67 "github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
78 "github.com/turbot/steampipe-plugin-sdk/v5/memoize"
89 "github.com/turbot/steampipe-plugin-sdk/v5/plugin"
@@ -54,7 +55,24 @@ func getSubscriptionIDUncached(ctx context.Context, d *plugin.QueryData, h *plug
5455 if err != nil {
5556 return nil , err
5657 }
57- return session .SubscriptionID , nil
58+
59+ client := subscriptions .NewClientWithBaseURI (session .ResourceManagerEndpoint )
60+ client .Authorizer = session .Authorizer
61+ subscriptionID := session .SubscriptionID
62+
63+ // Always fetch the subscription ID via an API call instead of relying on session.SubscriptionID.
64+ // The session value cannot be guaranteed to be consistent, particularly because `subscription_id`
65+ // is used as a connection-level key qualifier. Subscription ID may differ in letter casing,
66+ // which causes mismatches during query evaluation. To ensure consistency, we normalize the process
67+ // by retrieving the subscription ID through the API and reusing that value across connection-level
68+ // key quals and table-level columns.
69+ op , err := client .Get (ctx , subscriptionID )
70+ if err != nil {
71+ plugin .Logger (ctx ).Error ("getSubscriptionIDUncached" , "error" , err )
72+ return nil , err
73+ }
74+
75+ return * op .SubscriptionID , nil
5876}
5977
6078// if the caching is required other than per connection, build a cache key for the call and use it in Memoize.
0 commit comments