stateDiagram-v2
[*] --> request_for_new_cloud_service_onboarding
request_for_new_cloud_service_onboarding --> API
API --> cloud_service_onboarding_process
state cloud_service_onboarding_process {
[*] --> retrieve_public_documentation
retrieve_public_documentation --> retrieve_security_documentation
retrieve_security_documentation --> make_security_recommendations
make_security_recommendations --> build_azure_policy
build_azure_policy --> write_terraform
}
write_terraform --> update_ui
update_ui --> [*]
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Azure Container Apps
- Azure AI Foundry Service
- Make sure this is an Foundry project, it must have a
project endpoint. - OpenAI model (gpt-4o) deployed to this resource
Azure AI UserRBAC role (the code expects to use theDefaultAzureCredentialwhich requires this role)
- Make sure this is an Foundry project, it must have a
- Bing Custom Search
- Configure this resource to only search the Azure public documentation
- https://learn.microsoft.com/en-us/bing/search-apis/bing-custom-search/how-to/define-your-custom-view
- Use this URL as the
Allowed domains->Web Address:https://learn.microsoft.com/en-us/azure/. Make sure and setInclude subpagestoYes.
- Link it to your AI Foundry
- Configure this resource to only search the Azure public documentation
- App Insights
- Link it to your AI Foundry
- Log Analytics
- Managed Identity
- Optional services for Bring-Your-Own model
- Azure Storage Account
- Azure Cosmos DB
The cloud-security-agent will try and use internal security documentation to help it decide what security policies to recommend. If you have any internal security documentation, you can upload it to the src/api/app/agents/cloud_security_agent/files directory. These files will get uploaded to the Azure AI Agent service and the agent will use this data to help it make recommendations.
Perform each of the following sections in a new shell window.
-
Authenticate your local environment with Azure (this is used by the
DefaultAzureCredentialin code to authenticate)az login
-
Create a
/src/api/.envfile for the backend serviceAZURE_OPENAI_MODEL_DEPLOYMENT_NAME=<your-openai-model-deployment-name> AZURE_AI_AGENT_ENDPOINT=<your-ai-agent-endpoint> AZURE_AI_AGENT_API_VERSION=2025-01-01-preview APPLICATION_INSIGHTS_CONNECTION_STRING=<your-app-insights-connection-string> BING_CONNECTION_NAME=<your-bing-connection-name> BING_INSTANCE_NAME=<your-bing-instance-name>
-
Create a
/src/web/.envfile for the frontend serviceservices__api__api__0=http://127.0.0.1:8000
-
Navigate into the
src/apidirectorycd src/api -
Create a virtual environment
python -m venv .venv
-
Activate the virtual environment (Windows)
./.venv/Scripts/activate
-
Install the prerequisites
pip install -r ./requirements.txt
-
Run the API
python -m uvicorn app.main:app --log-level debug
-
Open a new shell
-
Navigate to the
src/webdirectorycd src/web -
Create a virtual environment
python -m venv .venv
-
Activate the virtual environment (Windows)
./.venv/Scripts/activate
-
Install the prerequisites
pip install -r ./requirements.txt
-
Run the web app
streamlit run ./app.py
-
Navigate to the URL that is printed
-
Navigate to the root of the repository
cd src -
Create a
.envfile in thesrcdirectory with the following content. The UID & GID are the user ID and group ID of the user that will run theazclicredsproxycontainer. These are needed because theazclicredsproxyneeds to be able to access the Azure CLI credentials stored in the~/.azuredirectory. If you are runningdockerfrom Linux, you don't need theDISTRONAMEparameter.
You can find the numerical UID & GID needed to access the ~/.azure directory by running the following command
shell stat -c "UID: %u, GID: %g" ~/.azure
```txt
UID=
GID=
USERNAME=
DISTRONAME=
```
-
Update the
docker-compose.ymlfile to select the appropriate volume mount for theazclicredsproxyservice. Comment out one or the other volume mounts as needed. -
Run the following command to build & run the Docker images locally
docker compose up --build
If you want additional logging to show up in AI Foundry and App Insights, set these environment variables in whichever environment you are running in.
SEMANTICKERNEL_EXPERIMENTAL_GENAI_ENABLE_OTEL_DIAGNOSTICS=true
export SEMANTICKERNEL_EXPERIMENTAL_GENAI_ENABLE_OTEL_DIAGNOSTICS
SEMANTICKERNEL_EXPERIMENTAL_GENAI_ENABLE_OTEL_DIAGNOSTICS_SENSITIVE=true
export SEMANTICKERNEL_EXPERIMENTAL_GENAI_ENABLE_OTEL_DIAGNOSTICS_SENSITIVE
AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED=true
export AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED
AZURE_SDK_TRACING_IMPLEMENTATION=opentelemetry
export AZURE_SDK_TRACING_IMPLEMENTATION- For local process, you can set these in the
.venv/bin/activatefile to have them set automatically when you activate the virtual environment.
