Showing posts with label Policy. Show all posts
Showing posts with label Policy. Show all posts

Tuesday, 7 September 2021

Microsoft Azure PowerShell Storage Creation Error - 403

I was recently completing a Microsoft Azure lab and was starting a new PowerShell window. Within the PowerShell setup page you need to set a storage account and file share in order to use the PowerShell. The specific (advanced) settings you need to select are:

  • Subscription
  • Cloud Shell Region
  • Resource Group
  • Storage Account
  • File Share
I already had a pre-defined subscription and resource group and the region appeared to be pre-selected based on my location (Europe). The next step is to create a new storage account and file share but pressing 'Create' gave a 403 error and the below error message.

{"error":{"code":"RequestDisallowedByPolicy","target":"the123cloud","message":"Resource 'the123cloud' was disallowed by policy. Policy identifiers: '[{\"policyAssignment\":{\"name\":\"Allowed locations\",\"id\":\"/providers/Microsoft.Management/managementGroups/temp/providers/Microsoft.Authorization/policyAssignments/1111111111111\"},\"policyDefinition\":{\"name\":\"Allowed locations\",\"id\":\"/providers/Microsoft.Authorization/policyDefinitions/22222222222222\"}},{\"policyAssignment\":{\"name\":\"Allowed locations - Exclude IoTCentral\...


The keywords in the error were "RequestDisallowedByPolicy" and "Allowed locations" which essentially means the Cloud Shell Region selected was disallowed either because it wasn't selected within the subscription policy OR was intentionally excluded.

  1. Select a valid region in the 'Cloud Shell Region' which is allowed
  2. Ask the administrator to allow the location in the subscriptions policies

Saturday, 20 July 2019

Connecting to db2 with JDBC Driver in App Connect Enterprise (ACE)

Whilst recently connecting to an IBM DB2 through an App Connect Enterprise (ACE) bar file following (parts of) this tutorial on developer works - https://developer.ibm.com/integration/blog/2019/01/15/connecting-integrations-to-jdbc-endpoints-on-app-connect/ I hit a couple of issues due to using different naming standards and from (naughtily) plucking specific parts from the article but not following it properly. 

I have been using IBM Cloud Private where both an ACE helm chart (11.0.0.4) and DB2 are both deployed with different names and data models than those defined in the example. If, like me, you bypassed parts of the example here are some issues you might have seen.

1. In containerised ACE deployment the JDBC Driver JAR should be loaded into the project to be packaged with the bar (as decribed in the article above)

a.    In the ACE Toolkit go to Window -> Show View-> Java
b.    Drag and drop the db2jcc4 JAR file into Project window
c.    Right Click (double finger click on the MAC) on the Java Project Folder and select Properties -> Java Build Path -> Click Add JARs -> Select db2jcc4 jar file -> Click OK
d.    Ensure the Java Project is included in the bar file
e.    Ensure “User JAR files that have been deployed in a .bar file” is set to true in the JDBC Policy as defined in the tutorial and that the policy is included in the bar file build

2. After the deployment there was still an error that persisted;
"com.ibm.broker.classloading.JarsURLClassLoader.findClass(JarsURLClassLoader.java:104)" 
I was able to find greater debug logs in ICP in the following file, in the following file;
/home/aceuser/ace-server/log/integration_server.<servername>.events.txt
6231E: An error occurred in node: Broker 'integration_server'; 
Node Type 'DeleteProducts_JavaCompute Exception details:  message: com.ibm.db2.jcc.DB2XADataSource stack trace:  java.net.URLClassLoader.findClass(URLClassLoader.java:610) \ncom.ibm.broker.classloading.JavaResourceClassLoader.findClass(JavaResourceClassLoader.java:180) \ncom.ibm.broker.classloading.SharedClassLoader.findClass(SharedClassLoader.java:209) \njava.lang.ClassLoader.loadClassHelper(ClassLoader.java:937
 The error looks like the jar has not been correctly loaded, to check we can;

  • Looking in the bar file on the toolkit in the ‘Manage’ tab which should show the jar file in the REST API Application.
  • Convert the bar file into a zip and unzip it to see the files inside where the jar should be visible.
If that all looks good, next you should check the JDBC connection in the Java Compute Node.
Connection conn= getJDBCType4Connection("BLUDB",                                      JDBC_TransactionType.MB_TRANSACTION_AUTO);
The example makes it look like BLUDB should match the name of the policy since the policy, database name and connection definition are all the same. The error also doesn’t point very well at what the issue is.

The connection should refer to the Database name being connected to. In my personal view, I would follow the example and call the policy the same name as the database being connected to which can be referred to in getJDBCType4Connection.


Hopefully this has helped you with your development!